Using unicode in javascript

In JavaScript, we can use the line of code below (which uses Unicode) to display a copyright symbol:

var x = "\u00A9 RPeripherals";

Why can't we enter the copyright symbol directly using the ALT code (alt + 0169) as shown below:

var x = "© RPeripherals" ;

What is the difference between these two methods?

0
source share
2 answers

Why can't we enter the copyright symbol directly using the ALT code (alt + 0169) as shown below:

Who is speaking? Of course you can. Just configure the code editor to use UTF-8 encoding for the source files. You should never use anything else to start with ...

What is the difference between these two methods?

, \uXXXX 2 5 . , , . , , , , , Unicode . -, , .

, , \uXXXX, , , Unicode. .

ECMAScript (v 262/5.1) ,

Unicode, 3.0 ISO/IEC 10646-1 UCS-2 UTF-16 , 3. ISO/IEC 10646-1 , BMP , 300. , UTF-16.

, , Unicode, UTF-16 ( , , UTF-8), , , . , UTF-8 . , , .

+1

JavaScript UTF-8.

?

, , , , , , .

() , ASCII , .

0

Source: https://habr.com/ru/post/1617548/


All Articles