File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ import { decode2string } from './_utils.js'
44
55export const E_STRICT = 'Input is not well-formed for this encoding'
66const xUserDefined = 'x-user-defined'
7+ const iso8i = 'iso-8859-8-i'
78
89export const assertEncoding = ( encoding ) => {
9- if ( Object . hasOwn ( encodings , encoding ) || encoding === xUserDefined ) return
10+ if ( Object . hasOwn ( encodings , encoding ) || encoding === xUserDefined || encoding === iso8i ) return
1011 throw new RangeError ( 'Unsupported encoding' )
1112}
1213
@@ -28,6 +29,7 @@ const decoders = new Map()
2829// Used only on Node.js, no reason to optimize for anything else
2930// E.g. avoiding .from and filling zero-initialized arr manually is faster on Hermes, but we avoid this codepath on Hermes completely
3031export function encodingMapper ( encoding ) {
32+ if ( encoding === iso8i ) encoding = 'iso-8859-8'
3133 const cached = mappers . get ( encoding )
3234 if ( cached ) return cached
3335
@@ -62,6 +64,7 @@ export function encodingMapper(encoding) {
6264}
6365
6466export function encodingDecoder ( encoding ) {
67+ if ( encoding === iso8i ) encoding = 'iso-8859-8'
6568 const cached = decoders . get ( encoding )
6669 if ( cached ) return cached
6770
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ function shouldUseNative(enc) {
2929}
3030
3131export function createSinglebyteDecoder ( encoding , loose = false ) {
32- if ( encoding === 'iso-8859-8-i' ) encoding = 'iso-8859-8'
3332 assertEncoding ( encoding )
3433
3534 if ( canDecoders && shouldUseNative ( encoding ) ) {
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ function latin1Prefix(arr, start) {
2424}
2525
2626export function createSinglebyteDecoder ( encoding , loose = false ) {
27- if ( encoding === 'iso-8859-8-i' ) encoding = 'iso-8859-8'
2827 const latin1path = encoding === 'windows-1252'
2928 if ( isDeno ) {
3029 const jsDecoder = encodingDecoder ( encoding ) // asserts
You can’t perform that action at this time.
0 commit comments