Skip to content

Commit

Permalink
support utf8 as well as utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
samthor committed Mar 6, 2020
1 parent 4cfbed1 commit 1479659
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions text.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (scope['TextEncoder'] && scope['TextDecoder']) {
* @param {string=} utfLabel
*/
function FastTextEncoder(utfLabel='utf-8') {
if (utfLabel !== 'utf-8') {
if (utfLabel !== 'utf-8' && utfLabel !== 'utf8') {
throw new RangeError(
`Failed to construct 'TextEncoder': The encoding label provided ('${utfLabel}') is invalid.`);
}
Expand Down Expand Up @@ -114,7 +114,7 @@ FastTextEncoder.prototype.encode = function(string, options={stream: false}) {
* @param {{fatal: boolean}=} options
*/
function FastTextDecoder(utfLabel='utf-8', options={fatal: false}) {
if (utfLabel !== 'utf-8') {
if (utfLabel !== 'utf-8' && utfLabel !== 'utf8') {
throw new RangeError(
`Failed to construct 'TextDecoder': The encoding label provided ('${utfLabel}') is invalid.`);
}
Expand Down

0 comments on commit 1479659

Please sign in to comment.