The js unicode encoding resolves two methods for converting data to Chinese



var str = "\u6211\u662Funicode\u7F16\u7801";

There are two common methods for converting such data into Chinese.

1. The eval parsing


str = eval("'" + str + "'"); //"I'm unicode."

2. Unescape parsing


str = unescape(str.replace(/\u/g, "%u")); //"I'm unicode."

Small knowledge, the record shares below