Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 4352ef3301e2f56a44689bc27459219b8cf1961e..0a4d47d84d2f6c1f5ed572ca9f303c3d889ec4f5 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -3314,7 +3314,7 @@ Local<String> v8::Object::ObjectProtoToString() { |
const char* postfix = "]"; |
int prefix_len = i::StrLength(prefix); |
- int str_len = str->Length(); |
+ int str_len = str->Utf8Length(); |
int postfix_len = i::StrLength(postfix); |
int buf_len = prefix_len + str_len + postfix_len; |
@@ -3326,7 +3326,7 @@ Local<String> v8::Object::ObjectProtoToString() { |
ptr += prefix_len; |
// Write real content. |
- str->WriteAscii(ptr, 0, str_len); |
+ str->WriteUtf8(ptr, str_len); |
ptr += str_len; |
// Write postfix. |
@@ -6451,9 +6451,10 @@ String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) |
TryCatch try_catch; |
Handle<String> str = obj->ToString(); |
if (str.IsEmpty()) return; |
- length_ = str->Length(); |
+ length_ = str->Utf8Length(); |
str_ = i::NewArray<char>(length_ + 1); |
- str->WriteAscii(str_); |
+ str->WriteUtf8(str_); |
+ ASSERT(i::String::NonAsciiStart(str_, length_) >= length_); |
} |