如何将KSC5601转换成unicode
how to convert KSC5601 to unicode
我想将 KSC5601 转换为 javascript 中的 unicode。例如,“〈”符号的KSC5601编码为A1B4。
当我获得 KSC5601 代码时,我需要将代码更改为 Unicode“3008”以显示在网站 IE 上。我必须使用 javascript 或 jquery.
有谁知道这件事。
使用TextDecoder
API to decode text of various encodings. The Encoding Standard states that a conformant user agent must support the "euc-kr" legacy multi-byte Korean encoding。例如,如果您有:
var dataIn = new Uint8Array([0xA1, 0xB4]);
然后您可以运行将其解码为字符串:
var str = new TextDecoder('KSC5601').decode(dataIn);
下一部分是查找字符的 Unicode 代码点。一些现代浏览器支持 codePointAt
来获取给定字符的代码点。在某些情况下,您也可以使用 charCodeAt
。例如,在这种情况下,您可以执行以下操作以获得所需的 0x3008
:
var codePoint = str.codePointAt(0);
我想将 KSC5601 转换为 javascript 中的 unicode。例如,“〈”符号的KSC5601编码为A1B4。
当我获得 KSC5601 代码时,我需要将代码更改为 Unicode“3008”以显示在网站 IE 上。我必须使用 javascript 或 jquery.
有谁知道这件事。
使用TextDecoder
API to decode text of various encodings. The Encoding Standard states that a conformant user agent must support the "euc-kr" legacy multi-byte Korean encoding。例如,如果您有:
var dataIn = new Uint8Array([0xA1, 0xB4]);
然后您可以运行将其解码为字符串:
var str = new TextDecoder('KSC5601').decode(dataIn);
下一部分是查找字符的 Unicode 代码点。一些现代浏览器支持 codePointAt
来获取给定字符的代码点。在某些情况下,您也可以使用 charCodeAt
。例如,在这种情况下,您可以执行以下操作以获得所需的 0x3008
:
var codePoint = str.codePointAt(0);