Javascript - 将字符串转换为 UTF-16

发布于 2024-08-22 14:51:01 字数 139 浏览 2 评论 0原文

我第一次使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以歌曲疗慰 2024-08-29 14:51:01

Javascript 已在内部使用 UTF-16 - 使用 charCodeAt()来获取值。

Javascript already uses UTF-16 internally - use charCodeAt() to get the values.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文