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

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: Created 7 years, 4 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
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..bf768126f35b6990ee680addabda54d5892b5042 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.
jungshik at Google 2013/08/30 00:39:27 any reason to use decimal instead of hexadecimal?
jsbell 2013/08/30 00:43:56 Agreed - I was copying/pasting from a JS console.
+ { input: "'\\ud800'", expected: [239, 191, 189] }, // Surrogate half.
+ { input: "'\\udc00'", expected: [239, 191, 189] }, // Surrogate half.
+ { input: "'abc\\ud800123'", expected: [97, 98, 99, 239, 191, 189, 49, 50, 51] }, // Surrogate half.
+ { input: "'abc\\udc00123'", expected: [97, 98, 99, 239, 191, 189, 49, 50, 51] }, // 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') | Source/wtf/text/TextCodecUTF8.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698