PHP 的 md5() 的 Javascript 等价物也适用于多字节字符串?
编辑: 问题中提到的脚本和答案中指出的另一个脚本,都可以很好地处理多字节字符串 - 结果我的问题在其他地方。
有谁知道这样的实施? http://phpjs.org/functions/view/469 上的脚本运行良好,只是不在多字节字符串上。
EDIT: the script mentioned in the question, and the other script pointed among the answers, both work just fine with multibyte strings - turned out my problem was elsewhere.
Does anyone know of such implementation? The script at http://phpjs.org/functions/view/469 works well, just not on multibyte strings.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此实现似乎可以正确处理 UTF-8 字符串。 如果您想测试演示,请确保首先在浏览器设置中将页面编码更改为 UTF-8。
This implementation seems to handle UTF-8 strings correctly. If you want to test the demo, make sure you change the encoding of the page to UTF-8 in your browser settings first.
您发布的脚本具有
str = utf8_encode(str);
。您可能应该删除此行并将西里尔字母作为 UTF-8 传递。
The script you've posted has
str = utf8_encode(str);
.You should probably remove this line and pass in your Cyrillic as UTF-8.