0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

feat(web): add utf-16 and big5 to TextEncoder/TextDecoder (#8108)

This commit is contained in:
ali ahmed 2021-01-19 22:58:57 +02:00 committed by GitHub
parent 0e8e6d7251
commit 973c33c899
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1148 additions and 1305 deletions

View file

@ -59,15 +59,7 @@
"writable-streams/write"
],
"encoding": [
{
"name": "api-basics",
"expectFail": [
// TODO(lucacasonato): enable when we support utf-16
"Decode sample: utf-16le",
"Decode sample: utf-16be",
"Decode sample: utf-16"
]
},
"api-basics",
"api-invalid-label",
"api-replacement-encodings",
"api-surrogates-utf8",
@ -83,14 +75,7 @@
// "iso-2022-jp-decoder",
// TODO(lucacasonato): uses XMLHttpRequest unnecessarily. should be fixed upstream before enabling
// "replacement-encodings",
{
"name": "textdecoder-byte-order-marks",
"expectFail": [
// TODO(lucacasonato): enable when we support utf-16
"Byte-order marks: utf-16le",
"Byte-order marks: utf-16be"
]
},
"textdecoder-byte-order-marks",
{
"name": "textdecoder-copy",
"expectFail": [
@ -100,19 +85,8 @@
]
},
"textdecoder-fatal-single-byte",
{
"name": "textdecoder-fatal.",
// TODO(lucacasonato): enable when we support utf-16
"expectFail": ["Fatal flag: utf-16le - truncated code unit"]
},
{
"name": "textdecoder-ignorebom",
"expectFail": [
// TODO(lucacasonato): enable when we support utf-16
"BOM is ignored if ignoreBOM option is specified: utf-16le",
"BOM is ignored if ignoreBOM option is specified: utf-16be"
]
},
"textdecoder-fatal.",
"textdecoder-ignorebom",
{
"name": "textdecoder-labels",
"expectFail": [
@ -126,11 +100,6 @@
"iso-ir-58 => GBK",
"x-gbk => GBK",
"gb18030 => gb18030",
"big5 => Big5",
"big5-hkscs => Big5",
"cn-big5 => Big5",
"csbig5 => Big5",
"x-x-big5 => Big5",
"cseucpkdfmtjapanese => EUC-JP",
"euc-jp => EUC-JP",
"x-euc-jp => EUC-JP",
@ -154,39 +123,25 @@
"ksc5601 => EUC-KR",
"ksc_5601 => EUC-KR",
"windows-949 => EUC-KR",
"unicodefffe => UTF-16BE",
"utf-16be => UTF-16BE",
"csunicode => UTF-16LE",
"iso-10646-ucs-2 => UTF-16LE",
"ucs-2 => UTF-16LE",
"unicode => UTF-16LE",
"unicodefeff => UTF-16LE",
"utf-16 => UTF-16LE",
"utf-16le => UTF-16LE",
"x-user-defined => x-user-defined"
]
},
// TODO(lucacasonato): enable when we have stream support
// "textdecoder-streaming",
// TODO(lucacasonato): enable when we support utf-16
// "textdecoder-utf16-surrogates",
"textdecoder-utf16-surrogates",
{
"name": "textencoder-constructor-non-utf",
"expectFail": [
"Encoding argument supported for decode: GBK",
"Encoding argument supported for decode: gb18030",
"Encoding argument supported for decode: Big5",
"Encoding argument supported for decode: EUC-JP",
"Encoding argument supported for decode: ISO-2022-JP",
"Encoding argument supported for decode: Shift_JIS",
"Encoding argument supported for decode: EUC-KR",
"Encoding argument supported for decode: UTF-16BE",
"Encoding argument supported for decode: UTF-16LE",
"Encoding argument supported for decode: x-user-defined"
]
}
// TODO(lucacasonato): enable when we support utf-16
// "textencoder-utf16-surrogates",
},
"textencoder-utf16-surrogates"
// TODO(lucacasonato): uses XMLHttpRequest unnecessarily. should be fixed upstream before enabling
// "unsupported-encodings",
],

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,5 @@
# deno web
Op crate that implements Event, TextEncoder, TextDecoder.
Testing for text encoding is done via WPT in cli/.

View file

@ -159,20 +159,4 @@ mod tests {
}
});
}
#[test]
fn test_text_encoding() {
run_in_task(|mut cx| {
let mut isolate = setup();
isolate
.execute(
"text_encoding_test.js",
include_str!("text_encoding_test.js"),
)
.unwrap();
if let Poll::Ready(Err(_)) = isolate.poll_event_loop(&mut cx) {
unreachable!();
}
});
}
}

File diff suppressed because it is too large Load diff