How to decode unicode HTML by JavaScript?
decode, javascript, unicode
Solution
decodeURIComponent('\u003cb\u003estring\u003c/b\u003e');
// "<b>string</b>"
Edit - I would delete the above answer if I could.
The original question is a bit ambiguous.
`console.log('\u003cb\u003estring\u003c/b\u003e');` will already yield `<b>string</b>`
If the `\` characters are escaped, then a replacement method could be used to replace `\\` with just `\`, thus allowing the proper Unicode escape sequence.
Problem
How to use JavaScript to decode from: ``` \u003cb\u003estring\u003c/b\u003e ``` to ``` <b>string</b> ``` (I searched in internet, there are some site with same question, such as: Javascript html decoding or How to decode HTML entities but it dont have same encode fomat) Thank you very much!