Skip to content
  • bashi@chromium.org's avatar
    WTFString::utf8() should have a mode of conversion to use replacement character · f6cd21d9
    bashi@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=101678
    
    Source/JavaScriptCore:
    
    Reviewed by Alexey Proskuryakov.
    
    Follow the change on String::utf8()
    
    * runtime/JSGlobalObjectFunctions.cpp:
    (JSC::encode): Pass String::StrictConversion instead of true to String::utf8().
    
    Source/WebCore:
    
    Reviewed by Alexey Proskuryakov.
    
    Follow the change on String::utf8()
    
    No new tests. No changes in behavior.
    
    * Modules/websockets/WebSocket.cpp:
    (WebCore::WebSocket::close): Pass String::StrictConversion instead of true to String::utf8().
    * Modules/websockets/WebSocketChannel.cpp:
    (WebCore::WebSocketChannel::send): Ditto.
    * html/MediaFragmentURIParser.cpp:
    (WebCore::MediaFragmentURIParser::parseFragments): Ditto.
    * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
    (WebCore::MediaPlayerPrivate::notifyChallengeResult): Ditto.
    * platform/network/blackberry/rss/RSSFilterStream.cpp:
    (WebCore::RSSFilterStream::convertContentToHtml): Ditto.
    * platform/network/blackberry/rss/RSSGenerator.cpp:
    (WebCore::RSSGenerator::generateHtml): Ditto.
    
    Source/WebKit2:
    
    Reviewed by Alexey Proskuryakov.
    
    Update the symbol for String::utf8().
    
    * win/WebKit2.def:
    * win/WebKit2CFLite.def:
    
    Source/WTF:
    
    Reviewed by Alexander Pavlov.
    
    Introduce conversion mode to String::utf8().
    There are three conversion modes; lenient mode, strict mode, and
    "replacing unpaired surrogates with the replacement character" (replacement) mode.
    Lenient mode converts unpaired surrogates. Strict mode fails when there is an unpaired
    surrogates and returns CString(). Replacement mode replaces unpaired surrogates with
    the replacement character(U+FFFD). Replacement mode implements the algorithm defined at
    http://dev.w3.org/2006/webapi/WebIDL/#dfn-obtain-unicode. WebSocket::send() requires
    this algorithm to encode a string to utf-8.
    
    * wtf/text/WTFString.cpp:
    (WTF::String::utf8): Changed to take ConversionMode as the argument.
    * wtf/text/WTFString.h:
    (String):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    f6cd21d9