From 1ecd9f8a18da1af9f2090791b15a18ff3e68411d Mon Sep 17 00:00:00 2001 From: Ai Hoshino Date: Sat, 22 Jul 2023 13:01:26 +0800 Subject: handle `latin1` in `Bun__encoding__toString`. (#3739) Close: #3738 --- test/js/node/string_decoder/string-decoder.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/js/node/string_decoder/string-decoder.test.js') diff --git a/test/js/node/string_decoder/string-decoder.test.js b/test/js/node/string_decoder/string-decoder.test.js index aba73401a..5e8463955 100644 --- a/test/js/node/string_decoder/string-decoder.test.js +++ b/test/js/node/string_decoder/string-decoder.test.js @@ -250,3 +250,13 @@ it("invalid utf-8 input, pr #3562", () => { output += decoder.end(); expect(output).toStrictEqual("\uFFFD\uFFFD"); }); + +it("decoding latin1, issue #3738", () => { + const decoder = new RealStringDecoder("latin1"); + let output = ""; + output += decoder.write(Buffer.from("DD", "hex")); + output += decoder.write(Buffer.from("59", "hex")); + output += decoder.write(Buffer.from("DE", "hex")); + output += decoder.end(); + expect(output).toStrictEqual("ÝYÞ"); +}); -- cgit v1.2.3