<div class="codetitle"> <span><a style="CURSOR: pointer" data="75951" class="copybut" id="copybut75951" onclick="doCopy('code75951')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code75951"> <br>var str = "\u6211\u662Funicode\u7F16\u7801"; <br> </div> <br>关于这样的数据转换为中文问题,常用的两种方法。 <br><br>1. eval 解析 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="67665" class="copybut" id="copybut67665" onclick="doCopy('code67665')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code67665"> <br>str = eval("'" str "'"); // "我是unicode编码" <br> </div> <br>2. unescape 解析 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="45639" class="copybut" id="copybut45639" onclick="doCopy('code45639')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code45639"> <br>str = unescape(str.replace(/\u/g, "%u")); // "我是unicode编码" <br> </div> <br>小知识点,记录分享下