Javascript - 将字符串转换为 UTF-16
我第一次使用 Javascript,它是为了 sha-1 哈希值。我找到了执行此操作的代码,但其依赖项之一是将字符串转换为 utf-8 的方法,但我要比较的服务器使用 utf-16。我环顾四周,所有结果都以 utf-8 显示。有人至少能指出我正确的方向吗? 谢谢。
I am working with Javascript for one of the first times and its for a sha-1 hash. I have found code to do this, but one of its dependencies is a method to convert the string to utf-8, however the server I am comparing against utilizes utf-16. I have looked around and all my results keep showing up w/ utf-8. Can anybody at least point me in the right direction?
Thanks.
Javascript 已在内部使用 UTF-16 - 使用
charCodeAt()
来获取值。
Javascript already uses UTF-16 internally - use
charCodeAt()
to get the values.