| Summary: | Align UTF-16 decoder with Chrome, Firefox, and specification | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Alex Christensen <achristensen> | ||||||||
| Component: | New Bugs | Assignee: | Alex Christensen <achristensen> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | darin, webkit-bug-importer, youennf | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Alex Christensen
2020-09-01 16:32:52 PDT
Created attachment 407719 [details]
Patch
Created attachment 407728 [details]
Patch
Created attachment 407733 [details]
Patch
Comment on attachment 407733 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=407733&action=review > Source/WebCore/platform/text/TextCodecUTF16.cpp:65 > +String TextCodecUTF16::decode(const char* bytes, size_t length, bool flush, bool, bool& sawError) Can we reference https://encoding.spec.whatwg.org/#shared-utf-16-decoder Comment on attachment 407733 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=407733&action=review > Source/WebCore/platform/text/TextCodecUTF16.cpp:78 > + if (codeUnit >= 0xDC00 && codeUnit <= 0xDFFF) { If I was writing this code I would use U16_IS_LEAD here. > Source/WebCore/platform/text/TextCodecUTF16.cpp:79 > + result.appendCharacter(0x10000 + ((leadSurrogate - 0xD800) << 10) + codeUnit - 0xDC00); U16_GET_SUPPLEMENTARY > Source/WebCore/platform/text/TextCodecUTF16.cpp:87 > + if (codeUnit >= 0xD800 && codeUnit <= 0xDBFF) { U16_IS_LEAD > Source/WebCore/platform/text/TextCodecUTF16.cpp:91 > + if (codeUnit >= 0xDC00 && codeUnit <=0xDFFF) { U16_IS_TRAIL |