What does \u003C mean?

Javascript

Javascript Problem Overview


I'm looking at twitter's javascript file, and I see this in the templates hash:

Browse Interests{{/i}}\u003C/a\u003E\n        \u003C/li\u003E\n  {{#logged_in}}\n

What do those codes represent?

Javascript Solutions


Solution 1 - Javascript

It's a unicode character. In this case \u003C and \u003E mean :

> U+003C < Less-than sign > > U+003E > Greater-than sign

See a list here

Solution 2 - Javascript

That is a unicode character code that, when parsed by JavaScript as a string, is converted into its corresponding character (JavaScript automatically converts any occurrences of \uXXXX into the corresponding Unicode character). For example, your example would be:

Browse Interests{{/i}}</a>\n        </li>\n  {{#logged_in}}\n

As you can see, \u003C changes into < (less-than sign) and \u003E changes into > (greater-than sign).

In addition to the link posted by Raynos, this page from the Unicode website lists a lot of characters (so many that they decided to annoyingly group them) and this page has a (kind of) nice index.

Solution 3 - Javascript

It is a unicode char \u003C = <

Solution 4 - Javascript

Those are unicode escapes. The general unicode escapes looks like \uxxxx where xxxx are the hexadecimal digits of the ASCI characters. They are used mainly to insert special characters inside a javascript string.

Solution 5 - Javascript

Unicode all starts with \u e.g. \u0001

Solution 6 - Javascript

In JavaScript

unescape("\u003c")

to decode the unicode

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/unescape

Although unescape() is not strictly deprecated (as in "removed from the Web standards")

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBlankmanView Question on Stackoverflow
Solution 1 - JavascriptRaynosView Answer on Stackoverflow
Solution 2 - JavascriptjhartzView Answer on Stackoverflow
Solution 3 - JavascriptNeilView Answer on Stackoverflow
Solution 4 - JavascriptamurraView Answer on Stackoverflow
Solution 5 - JavascriptdevXenView Answer on Stackoverflow
Solution 6 - JavascriptA.R NaseefView Answer on Stackoverflow