"quickjs:encoding" (namespace)
constructor(label?: TextEncodingLabel);
input?: string,
options?: {
stream?: boolean;
},
): Uint8Array;
source: string,
destination: Uint8Array,
): {
read: number;
written: number;
};
}
| "utf-8"
| "utf-16le"
| "utf-16be"
| "shift_jis"
| "windows-1252"
| "windows-1251"
| "big5"
| "euc-kr"
| "euc-jp"
| "gb18030";
| "utf8"
| "unicode-1-1-utf-8"
| "utf-16"
| "shift-jis"
| "sjis"
| "csshiftjis"
| "ms932"
| "ms_kanji"
| "windows-31j"
| "x-sjis"
| "cp1252"
| "iso-8859-1"
| "iso8859-1"
| "iso_8859-1"
| "latin1"
| "iso-8859-15"
| "us-ascii"
| "ascii"
| "x-cp1252"
| "cp1251"
| "x-cp1251"
| "big5-hkscs"
| "cn-big5"
| "csbig5"
| "x-x-big5"
| "cseuckr"
| "korean"
| "ks_c_5601-1987"
| "iso-ir-149"
| "csksc"
| "cseucpkdfmtjapanese"
| "x-euc-jp"
| "gb2312"
| "gbk"
| "chinese"
| "csgb2312"
| "x-gbk"
| "gb_2312-80"
| "iso-ir-58";
constructor(
options?: {
},
);
input?: ArrayBuffer | ArrayBufferView,
options?: {
stream?: boolean;
},
): string;
}
}
"quickjs:encoding".toUtf8 (exported function)
"quickjs:encoding".fromUtf8 (exported function)
"quickjs:encoding".TextEncoder (exported class)
Encodes a string into bytes, following the WHATWG Encoding standard. Supports UTF-8, UTF-16LE, UTF-16BE, Shift_JIS, Windows-1252, Windows-1251, Big5, EUC-KR, EUC-JP, and GB18030 encodings.
constructor(label?: TextEncodingLabel);
input?: string,
options?: {
stream?: boolean;
},
): Uint8Array;
source: string,
destination: Uint8Array,
): {
read: number;
written: number;
};
}
TextEncoder (constructor)
constructor(label?: TextEncodingLabel);
TextEncoder.prototype.encoding (TextEncoding property)
TextEncoder.prototype.encode (method)
Encodes the input string into bytes.
@paraminput — The string to encode.@paramoptions — Options for encoding. Thestreamoption (non-standard) can be used to preserve state for stateful encodings like UTF-16.
stream?: boolean;
}): Uint8Array;
TextEncoder.prototype.encodeInto (method)
Encodes the source string into the destination Uint8Array. Note: Unlike the standard TextEncoder, this supports all encodings (non-standard extension).
read: number;
written: number;
};
"quickjs:encoding".TextEncoding (type)
The canonical encoding name returned by .encoding property
| "utf-8"
| "utf-16le"
| "utf-16be"
| "shift_jis"
| "windows-1252"
| "windows-1251"
| "big5"
| "euc-kr"
| "euc-jp"
| "gb18030";
"quickjs:encoding".TextEncodingLabel (type)
All encoding labels accepted by TextEncoder/TextDecoder constructor
| "utf8"
| "unicode-1-1-utf-8"
| "utf-16"
| "shift-jis"
| "sjis"
| "csshiftjis"
| "ms932"
| "ms_kanji"
| "windows-31j"
| "x-sjis"
| "cp1252"
| "iso-8859-1"
| "iso8859-1"
| "iso_8859-1"
| "latin1"
| "iso-8859-15"
| "us-ascii"
| "ascii"
| "x-cp1252"
| "cp1251"
| "x-cp1251"
| "big5-hkscs"
| "cn-big5"
| "csbig5"
| "x-x-big5"
| "cseuckr"
| "korean"
| "ks_c_5601-1987"
| "iso-ir-149"
| "csksc"
| "cseucpkdfmtjapanese"
| "x-euc-jp"
| "gb2312"
| "gbk"
| "chinese"
| "csgb2312"
| "x-gbk"
| "gb_2312-80"
| "iso-ir-58";
"quickjs:encoding".TextDecoder (exported class)
Decodes bytes into a string, following the WHATWG Encoding standard. Supports UTF-8, UTF-16LE, UTF-16BE, Shift_JIS, Windows-1252, Windows-1251, Big5, EUC-KR, EUC-JP, and GB18030 encodings.
constructor(
options?: {
},
);
input?: ArrayBuffer | ArrayBufferView,
options?: {
stream?: boolean;
},
): string;
}
TextDecoder (constructor)
TextDecoder.prototype.encoding (TextEncoding property)
TextDecoder.prototype.fatal (boolean property)
TextDecoder.prototype.ignoreBOM (boolean property)
TextDecoder.prototype.decode (method)
stream?: boolean;
}): string;