0

How can I print the unicode UTF-16 code point of a character?

I want to provide a character and print the unicode in format \uXXXX. How can I achieve this?

30th Nov 2017, 7:30 PM
Jozxyqk
Jozxyqk - avatar
1 Respuesta
0
Any character with a character code lower than 256 (i.e. any character in the extended ASCII range) can be escaped using its hex-encoded character code, prefixed with \x. (Note that this is the same range of characters that can be escaped through octal escapes.) Hexadecimal escapes are four characters long. They require exactly two characters following \x. If the hexadecimal character code is only one character long (this is the case for all character codes smaller than 16, or 10 in hex), you’ll need to pad it with a leading 0. For example, the copyright symbol ('©') has character code 169, which gives A9 in hex, so you could write it as '\xA9'. The hexadecimal part of this escape is case-insensitive; in other words, '\xa9' and '\xA9' are equivalent. You could define hexadecimal escape syntax using the following regular expression: \\x[a-fA-F0-9]{2}. It’s a bit confusing that the spec refers to this kind of escape sequence as “hexadecimal”, since Unicode escapes use hex as well. Use the following link: 1. https://mothereff.in/js-escapes#0Fingerspitzengef%C3%BChl%20is%20a%20German%20term.%5CnIt%E2%80%99s%20pronounced%20as%20follows%3A%20%5B%CB%88f%C9%AA%C5%8B%C9%90%CB%8C%CA%83p%C9%AAts%C9%99n%C9%A1%C9%99%CB%8Cfy%CB%90l%5D 2. https://mathiasbynens.be/notes/javascript-escapes
16th Dec 2017, 1:47 PM
Bits!