如下这种生成随机汉字的方式打印不出汉字。有没有其它办法?
let word = '\\u' +(Math.round(Math.random() * 20901) + 19968).toString(16); console.log(word); //打印 \u64d3
String.fromCodePoint(Math.round(Math.random() * 20901) + 19968)
function decodeUnicode(str) { str = str.replace(/\\/g, "%"); return unescape(str); }
Unicode解码一下?
@dislido OK
但是会有很多奇怪的字。
CNode 社区为国内最专业的 Node.js 开源技术社区,致力于 Node.js 的技术研究。
Unicode解码一下?
@dislido OK