Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: LayoutTests/fast/encoding/api/surrogate-pairs.html

Issue 23601010: Make UTF-8 encoding of unpaired surrogates match Encoding standard (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased test results Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/surrogate-pairs-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/encoding/api/surrogate-pairs.html
diff --git a/LayoutTests/fast/encoding/api/surrogate-pairs.html b/LayoutTests/fast/encoding/api/surrogate-pairs.html
index 8be62c4076cc67cbdb6b9308f5a080a8bc27fcf0..dc35210026070d29f3280d3f855e1e2bff041a6e 100644
--- a/LayoutTests/fast/encoding/api/surrogate-pairs.html
+++ b/LayoutTests/fast/encoding/api/surrogate-pairs.html
@@ -5,19 +5,18 @@
description("Test invalid UTF-16 surrogate pairs with UTF-8 encoding");
var badStrings = [
- { input: 'abc123', expected: 'abc123' }, // Sanity check.
- { input: '\ud800', expected: '\ufffd' }, // Surrogate half.
- { input: '\udc00', expected: '\ufffd' }, // Surrogate half.
- { input: 'abc\ud800def', expected: 'abc\ufffddef' }, // Surrogate half.
- { input: 'abc\udc00def', expected: 'abc\ufffddef' }, // Surrogate half.
- { input: '\udc00\ud800', expected: '\ufffd\ufffd' } // Wrong order.
+ { input: "'abc123'", expected: [97, 98, 99, 49, 50, 51] }, // Sanity check.
+ { input: "'\\ud800'", expected: [0xef, 0xbf, 0xbd] }, // Surrogate half.
+ { input: "'\\udc00'", expected: [0xef, 0xbf, 0xbd] }, // Surrogate half.
+ { input: "'abc\\ud800123'", expected: [0x61, 0x62, 0x63, 0xef, 0xbf, 0xbd, 0x31, 0x32, 0x33] }, // Surrogate half.
+ { input: "'abc\\udc00123'", expected: [0x61, 0x62, 0x63, 0xef, 0xbf, 0xbd, 0x31, 0x32, 0x33] }, // Surrogate half.
+ { input: "'\\udc00\\ud800'", expected: [239, 191, 189, 239, 191, 189] } // Wrong order.
];
badStrings.forEach(
function(t) {
- evalAndLog("encoded = new TextEncoder('utf-8').encode(" + JSON.stringify(t.input) + ")");
- evalAndLog("decoded = new TextDecoder('utf-8').decode(encoded)");
- shouldBeEqualToString("decoded", t.expected);
+ evalAndLog("encoded = new TextEncoder('utf-8').encode(" + t.input + ")");
+ shouldBeEqualToString("JSON.stringify([].slice.call(encoded))", JSON.stringify(t.expected));
debug("");
});
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/surrogate-pairs-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698