在JavaScript中标准化非ASCII Unicode数字和字母
我正在处理一些用户输入。其中一些使用非 ASCII 数字和字母字符(例如 ④❹
I am processing some user input. Some of them use non-ASCII digits and alphabets characters (e.g. ④❹????????????????????????), and I want to convert them to regular characters (a-zA-Z0-9).
I found that google search and google chrome can hit these by regular characters.
Is there any package, prebuilt table or algorithm to replace such non-ASCII characters into the regular one without listing all of them by myself?
Edit: I have found string.normalize("NFKD") but it seems not working for some cases (see snippet below).
console.log("④❹???????? ????????????????".normalize("NFKD"))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论