diff options
author | Victoria Lease <violets@google.com> | 2012-05-23 17:00:50 -0700 |
---|---|---|
committer | Victoria Lease <violets@google.com> | 2012-05-24 09:47:17 -0700 |
commit | 62d3ac39c19a7b4160a180140ac8f1685c0df19a (patch) | |
tree | 768d94c5bdde93bf7155fbe4aa124d8a7f420118 | |
parent | 55d602593a60888cfc87c244a5e3258f35bae50e (diff) | |
download | external_webkit-62d3ac39c19a7b4160a180140ac8f1685c0df19a.zip external_webkit-62d3ac39c19a7b4160a180140ac8f1685c0df19a.tar.gz external_webkit-62d3ac39c19a7b4160a180140ac8f1685c0df19a.tar.bz2 |
properly convert data from utf-16 to utf-8 in LoadData()
GetStringUTFChars() was turning U+1F382 into garbage data: 0xED 0xA0
0xBC 0xED 0xBE 0x82. WTF::String's UChar* constructor converts this
codepoint into proper UTF-8: 0xF0 0x9F 0x8E 0x82.
Bug: 5961185
Change-Id: Ie8f1ef9b633bda5f7e93570eab9118b35911e93e
-rw-r--r-- | Source/WebKit/android/jni/WebCoreFrameBridge.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp index af582fa..829c21c 100644 --- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -1290,12 +1290,12 @@ static void LoadData(JNIEnv *env, jobject obj, jstring baseUrl, jstring data, WebCore::ResourceRequest request(jstringToWtfString(env, baseUrl)); // Setup the substituteData - const char* dataStr = env->GetStringUTFChars(data, NULL); + WTF::CString cData = jstringToWtfString(env, data).utf8(); + const char* dataStr = cData.data(); WTF::RefPtr<WebCore::SharedBuffer> sharedBuffer = WebCore::SharedBuffer::create(); ALOG_ASSERT(dataStr, "nativeLoadData has a null data string."); - sharedBuffer->append(dataStr, strlen(dataStr)); - env->ReleaseStringUTFChars(data, dataStr); + sharedBuffer->append(dataStr, strlen(dataStr)); // copy dataStr WebCore::SubstituteData substituteData(sharedBuffer, jstringToWtfString(env, mimeType), jstringToWtfString(env, encoding), |