Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ function getDecoder(charset) {
charset = charset.toLowerCase();
continue;
}
return decoders.other.bind(charset);
return decoders.other(charset);
}
}
}
Expand Down Expand Up @@ -458,13 +458,13 @@ const decoders = {
return data.base64Slice(0, data.length);
},

other: (data, hint) => {
other: (charset) => (data, hint) => {
if (data.length === 0)
return '';
if (typeof data === 'string')
data = Buffer.from(data, 'latin1');
try {
const decoder = new TextDecoder(this);
const decoder = new TextDecoder(charset);
return decoder.decode(data);
} catch {}
},
Expand Down