Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index d2d641560754a8ce56da283c5cf81a4f8556b441..d34d6c2c9787af3c26b226fdf8eea020c4b98943 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -2750,7 +2750,11 @@ BUILTIN(DateConstructor) { |
char buffer[128]; |
Vector<char> str(buffer, arraysize(buffer)); |
ToDateString(time_val, str, isolate->date_cache()); |
- return *isolate->factory()->NewStringFromAsciiChecked(str.start()); |
+ Handle<String> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, |
+ isolate->factory()->NewStringFromUtf8(CStrVector(buffer))); |
+ return *result; |
} |
@@ -3330,7 +3334,11 @@ BUILTIN(DatePrototypeToDateString) { |
char buffer[128]; |
Vector<char> str(buffer, arraysize(buffer)); |
ToDateString(date->value()->Number(), str, isolate->date_cache(), kDateOnly); |
- return *isolate->factory()->NewStringFromAsciiChecked(str.start()); |
+ Handle<String> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, |
+ isolate->factory()->NewStringFromUtf8(CStrVector(buffer))); |
+ return *result; |
} |
@@ -3370,7 +3378,11 @@ BUILTIN(DatePrototypeToString) { |
char buffer[128]; |
Vector<char> str(buffer, arraysize(buffer)); |
ToDateString(date->value()->Number(), str, isolate->date_cache()); |
- return *isolate->factory()->NewStringFromAsciiChecked(str.start()); |
+ Handle<String> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, |
+ isolate->factory()->NewStringFromUtf8(CStrVector(buffer))); |
+ return *result; |
} |
@@ -3381,7 +3393,11 @@ BUILTIN(DatePrototypeToTimeString) { |
char buffer[128]; |
Vector<char> str(buffer, arraysize(buffer)); |
ToDateString(date->value()->Number(), str, isolate->date_cache(), kTimeOnly); |
- return *isolate->factory()->NewStringFromAsciiChecked(str.start()); |
+ Handle<String> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, |
+ isolate->factory()->NewStringFromUtf8(CStrVector(buffer))); |
+ return *result; |
} |