aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zilin Zhu <zhuzilinallen@gmail.com> 2022-09-02 14:11:09 +0800
committerGravatar GitHub <noreply@github.com> 2022-09-01 23:11:09 -0700
commit2dc07d7505d44af58da3dd5a6d370f67ee80e0fd (patch)
treed4062cd4a4bcdacdf5a28b316b27ee5ec93e0ccc /src
parent4e73726bee8f5c773792530f319713474273c48d (diff)
downloadbun-2dc07d7505d44af58da3dd5a6d370f67ee80e0fd.tar.gz
bun-2dc07d7505d44af58da3dd5a6d370f67ee80e0fd.tar.zst
bun-2dc07d7505d44af58da3dd5a6d370f67ee80e0fd.zip
Fix failing Buffer tests (#1197)
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/webcore/encoding.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bun.js/webcore/encoding.zig b/src/bun.js/webcore/encoding.zig
index 00b89d576..a6d98fc76 100644
--- a/src/bun.js/webcore/encoding.zig
+++ b/src/bun.js/webcore/encoding.zig
@@ -707,10 +707,10 @@ pub const Encoder = struct {
}
export fn Bun__encoding__byteLengthLatin1(input: [*]const u8, len: usize, encoding: u8) usize {
return switch (@intToEnum(JSC.Node.Encoding, encoding)) {
- .utf8 => byteLengthU8(input, len, .hex),
- .latin1 =>byteLengthU8(input, len, .ascii),
+ .utf8 => byteLengthU8(input, len, .utf8),
+ .latin1 => byteLengthU8(input, len, .ascii),
.ascii => byteLengthU8(input, len, .ascii),
- .ucs2 =>byteLengthU8(input, len, .utf16le),
+ .ucs2 => byteLengthU8(input, len, .utf16le),
.utf16le => byteLengthU8(input, len, .utf16le),
.base64 => byteLengthU8(input, len, .base64),
.base64url => byteLengthU8(input, len, .base64url),
@@ -720,10 +720,10 @@ pub const Encoder = struct {
}
export fn Bun__encoding__byteLengthUTF16(input: [*]const u16, len: usize, encoding: u8) usize {
return switch (@intToEnum(JSC.Node.Encoding, encoding)) {
- .utf8 => byteLengthU16(input, len, .hex),
- .latin1 =>byteLengthU16(input, len, .ascii),
+ .utf8 => byteLengthU16(input, len, .utf8),
+ .latin1 => byteLengthU16(input, len, .ascii),
.ascii => byteLengthU16(input, len, .ascii),
- .ucs2 =>byteLengthU16(input, len, .utf16le),
+ .ucs2 => byteLengthU16(input, len, .utf16le),
.utf16le => byteLengthU16(input, len, .utf16le),
.base64 => byteLengthU16(input, len, .base64),
.base64url => byteLengthU16(input, len, .base64url),