如何在JavaScript中转换Unicode? [英] How to convert unicode in JavaScript?
本文介绍了如何在JavaScript中转换Unicode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Google Maps API。请参阅 JSON响应 。
I'm using the Google Maps API. Please see this JSON response.
HTML指令是这样写的:
The HTML instructions is written like this:
"html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003eEnggårdsgade\u003c/b\u003e"
如何转换unicodes \\\<
, \\\> $ c $在JavaScript中?>
How can I convert the unicodes \u003c
, \u003e
etc. in JavaScript?
推荐答案
这些都是 Unicode字符转义序列。就JavaScript而言,它们是同一个字符。
Those are Unicode character escape sequences in a JavaScript string. As far as JavaScript is concerned, they are the same character.
'\u003cb\u003eleft\u003c/b\u003e' == '<b>left</b>'; // true
所以,你根本不需要做任何转换。
So, you don’t need to do any conversion at all.
这篇关于如何在JavaScript中转换Unicode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文