Reviewed by Darin.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2007 07:12:55 +0000 (07:12 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2007 07:12:55 +0000 (07:12 +0000)
commit3e6a230c9df2cc3be8ef5e844c30d2759301bf20
tree9d70d3ee1500132a4fae1b467c30d27582a9e9b7
parent2aaff1c430c4d31e3ec9e69c509520c6a4ee7374
    Reviewed by Darin.

        http://bugs.webkit.org/show_bug.cgi?id=15953
        Add UTF-8 encoding/decoding to WTF

        * kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
        * kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
        parameter. Callers are not interested in getting decoding results in strict mode, so
        this allows for bailing out as soon as an error is seen.

        * kjs/function.cpp:
        (KJS::encode): Updated for new UString::UTF8String() signature.

        * API/JSStringRef.cpp:
        (JSStringCreateWithCharacters): Disambiguate UChar.
        (JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
        * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().

        * wtf/unicode/UTF8.cpp: Added.
        (WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
        (WTF::Unicode::inlineUTF8SequenceLength):
        (WTF::Unicode::UTF8SequenceLength):
        (WTF::Unicode::decodeUTF8Sequence):
        (WTF::Unicode::):
        (WTF::Unicode::ConvertUTF16ToUTF8):
        (WTF::Unicode::isLegalUTF8):
        (WTF::Unicode::ConvertUTF8ToUTF16):
        * wtf/unicode/UTF8.h: Added.
        (WTF::Unicode::):
        Some code moved from ustring.h, some adapted from unicode.org sources.

        * JavaScriptCore.exp:
        * JavaScriptCore.pri:
        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * JavaScriptCoreSources.bkl:
        Added UTF8.{h,cpp}

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
JavaScriptCore/API/JSStringRef.cpp
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/JavaScriptCore.pri
JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/JavaScriptCoreSources.bkl
JavaScriptCore/bindings/c/c_utility.cpp
JavaScriptCore/kjs/function.cpp
JavaScriptCore/kjs/ustring.cpp
JavaScriptCore/kjs/ustring.h
JavaScriptCore/wtf/unicode/UTF8.cpp [new file with mode: 0644]
JavaScriptCore/wtf/unicode/UTF8.h [new file with mode: 0644]