-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
util: fix Latin1 decoding to return string output
PR-URL: #56222 Fixes: #56219 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
1d8cc61
commit 1381541
Showing
3 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
const test = require('node:test'); | ||
const assert = require('node:assert'); | ||
|
||
test('TextDecoder correctly decodes windows-1252 encoded data', { skip: !common.hasIntl }, () => { | ||
const latin1Bytes = new Uint8Array([0xc1, 0xe9, 0xf3]); | ||
|
||
const expectedString = 'Áéó'; | ||
|
||
const decoder = new TextDecoder('windows-1252'); | ||
const decodedString = decoder.decode(latin1Bytes); | ||
|
||
assert.strictEqual(decodedString, expectedString); | ||
}); |