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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Javascript 已在内部使用 UTF-16 - 使用
charCodeAt()
来获取值。
Javascript already uses UTF-16 internally - use
charCodeAt()
to get the values.