The UString and String classes have ascii() and utf8() methods that can handle 8 bit strings more efficiently.
Created attachment 115059 [details] Patch
I think "#include <wtf/unicode/Unicode.h>" vs "#include Unicode.h" might fix the Windows build.
Comment on attachment 115059 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=115059&action=review r=me > Source/JavaScriptCore/runtime/UString.cpp:425 > + if (is8Bit()) { > + const LChar* characters = this->characters8(); > + > + ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size()); > + ASSERT_UNUSED(result, result != targetExhausted); // (length * 3) should be sufficient for any conversion I think it's confusing to pretend that our underlying buffer is UTF16, when our convention is to say that it's Latin1. So, to produce UTF8 data from an LChar buffer, let's use a function called convertLatin1ToUTF8. > Source/JavaScriptCore/wtf/text/WTFString.cpp:732 > + ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size()); > + ASSERT_UNUSED(result, result != targetExhausted); // (length * 3) should be sufficient for any conversion Same comment here.
Created attachment 115243 [details] Updated patch with speculative Windows fix
Attachment 115243 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1 Source/JavaScriptCore/wtf/unicode/UTF8.cpp:157: A case label should not be indented, but line up with its switch statement. [whitespace/indent] [4] Total errors found: 1 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 115283 [details] Patch - Windows Build Fix - This time for sure!
Created attachment 115294 [details] Patch updated with missing export
Committed r100405: <http://trac.webkit.org/changeset/100405>