⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 268843 in webkit


Ignore:
Timestamp:
Oct 21, 2020, 4:09:27 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Implement ISO-2022-JP encoder step 3
https://bugs.webkit.org/show_bug.cgi?id=218046

Patch by Alex Christensen <achristensen@webkit.org> on 2020-10-21
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

  • web-platform-tests/encoding/iso-2022-jp-encoder-expected.txt:
  • web-platform-tests/encoding/iso-2022-jp-encoder.html:

Source/WebCore:

https://encoding.spec.whatwg.org/#iso-2022-jp-encoder step 3 was put in a few years ago and recently implemented by Firefox.
Covered by updated and newly passing web platform tests.

  • platform/text/TextCodecCJK.cpp:

(WebCore::iso2022JPEncode):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r268812 r268843  
     12020-10-21  Alex Christensen  <achristensen@webkit.org>
     2
     3        Implement ISO-2022-JP encoder step 3
     4        https://bugs.webkit.org/show_bug.cgi?id=218046
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/encoding/iso-2022-jp-encoder-expected.txt:
     9        * web-platform-tests/encoding/iso-2022-jp-encoder.html:
     10
    1112020-10-21  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/iso-2022-jp-encoder-expected.txt

    r267659 r268843  
    22PASS iso-2022-jp encoder: very basic
    33PASS iso-2022-jp encoder: basics
     4PASS iso-2022-jp encoder: Katakana
     5PASS iso-2022-jp encoder: jis0208
    46PASS iso-2022-jp encoder: SO/SI ESC
     7PASS iso-2022-jp encoder: Roman SO/SI ESC
     8PASS iso-2022-jp encoder: Katakana SO/SI ESC
     9PASS iso-2022-jp encoder: jis0208 SO/SI ESC
    510PASS iso-2022-jp encoder: U+FFFD
     11PASS iso-2022-jp encoder: Roman U+FFFD
     12PASS iso-2022-jp encoder: Katakana U+FFFD
     13PASS iso-2022-jp encoder: jis0208 U+FFFD
    614
  • trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/iso-2022-jp-encoder.html

    r256730 r268843  
    1313 }
    1414
    15  encode("s", "s", "very basic")
    16  encode("\u00A5\u203Es\\\uFF90\u4F69", "%1B(J\\~s%1B(B\\%1B$B%_PP%1B(B", "basics")
    17  encode("\x0E\x0F\x1Bx", "%0E%0F%1Bx", "SO/SI ESC")
     15 encode("s", "s", "very basic");
     16 encode("\u00A5\u203Es\\\uFF90\u4F69", "%1B(J\\~s%1B(B\\%1B$B%_PP%1B(B", "basics");
     17 encode("\uFF61", "%1B$B!%23%1B(B", "Katakana");
     18 encode("\u0393", "%1B$B&%23%1B(B", "jis0208");
     19 encode("\x0E\x0F\x1Bx", "%26%2365533%3B%26%2365533%3B%26%2365533%3Bx", "SO/SI ESC");
     20 encode("\u203E\x0E\x0F\x1Bx", "%1B(J~%26%2365533%3B%26%2365533%3B%26%2365533%3Bx%1B(B", "Roman SO/SI ESC");
     21 encode("\uFF61\x0E\x0F\x1Bx", "%1B$B!%23%1B(B%26%2365533%3B%26%2365533%3B%26%2365533%3Bx", "Katakana SO/SI ESC");
     22 encode("\u0393\x0E\x0F\x1Bx", "%1B$B&%23%1B(B%26%2365533%3B%26%2365533%3B%26%2365533%3Bx", "jis0208 SO/SI ESC");
    1823 encode("\uFFFD", "%26%2365533%3B", "U+FFFD");
     24 encode("\u203E\uFFFD", "%1B(J~%26%2365533%3B%1B(B", "Roman U+FFFD");
     25 encode("\uFF61\uFFFD", "%1B$B!%23%1B(B%26%2365533%3B", "Katakana U+FFFD");
     26 encode("\u0393\uFFFD", "%1B$B&%23%1B(B%26%2365533%3B", "jis0208 U+FFFD");
    1927</script>
  • trunk/Source/WebCore/ChangeLog

    r268841 r268843  
     12020-10-21  Alex Christensen  <achristensen@webkit.org>
     2
     3        Implement ISO-2022-JP encoder step 3
     4        https://bugs.webkit.org/show_bug.cgi?id=218046
     5
     6        Reviewed by Darin Adler.
     7
     8        https://encoding.spec.whatwg.org/#iso-2022-jp-encoder step 3 was put in a few years ago and recently implemented by Firefox.
     9        Covered by updated and newly passing web platform tests.
     10
     11        * platform/text/TextCodecCJK.cpp:
     12        (WebCore::iso2022JPEncode):
     13
    1142020-10-21  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebCore/platform/text/TextCodecCJK.cpp

    r266729 r268843  
    484484    Function<void(UChar32)> parseCodePoint;
    485485    parseCodePoint = [&] (UChar32 codePoint) {
     486        if ((state == State::ASCII || state == State::Roman) && (codePoint == 0x000E || codePoint == 0x000F || codePoint == 0x001B)) {
     487            statefulUnencodableHandler(replacementCharacter, result);
     488            return;
     489        }
    486490        if (state == State::ASCII && isASCII(codePoint)) {
    487491            result.append(codePoint);
Note: See TracChangeset for help on using the changeset viewer.