You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/99-js-misc/06-unicode/article.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
# Unicode, String internals
3
3
4
4
```warn header="Advanced knowledge"
5
-
The section goes deeper into string internals. This knowledge will be useful for you if you plan to deal with emoji, rare mathematical or hieroglyphic characters or other rare symbols.
5
+
The section goes deeper into string internals. This knowledge will be useful for you if you plan to deal with emoji, rare mathematical or hieroglyphic characters, or other rare symbols.
6
6
```
7
7
8
8
As we already know, JavaScript strings are based on [Unicode](https://en.wikipedia.org/wiki/Unicode): each character is represented by a byte sequence of 1-4 bytes.
@@ -11,21 +11,21 @@ JavaScript allows us to insert a character into a string by specifying its hexad
11
11
12
12
-`\xXX`
13
13
14
-
`XX` must be two hexadecimal digits with value between `00` and `FF`, then it's character whose Unicode code is `XX`.
14
+
`XX` must be two hexadecimal digits with a value between `00` and `FF`, then it's a character whose Unicode code is `XX`.
15
15
16
16
Because the `\xXX` notation supports only two digits, it can be used only for the first 256 Unicode characters.
17
17
18
-
These first 256 characters include latin alphabet, most basic syntax characters and some others. For example, `"\x7A"` is the same as `"z"` (Unicode `U+007A`).
18
+
These first 256 characters include the latin alphabet, most basic syntax characters, and some others. For example, `"\x7A"` is the same as `"z"` (Unicode `U+007A`).
`XXXX` must be exactly 4 hex digits with the value between `0000` and `FFFF`, then `\uXXXX` is a character whose Unicode code is `XXXX`.
26
+
`XXXX` must be exactly 4 hex digits with the value between `0000` and `FFFF`, then `\uXXXX` is a character whose Unicode code is `XXXX`.
27
27
28
-
Characters with Unicode value greater than `U+FFFF` can also be represented with this notation, but in this case we will need to use a so called surrogate pair (we will talk about surrogate pairs later in this chapter).
28
+
Characters with Unicode values greater than `U+FFFF` can also be represented with this notation, but in this case, we will need to use a so called surrogate pair (we will talk about surrogate pairs later in this chapter).
@@ -120,7 +120,7 @@ For instance, the letter `a` can be the base character for these characters: `à
120
120
121
121
Most common "composite" characters have their own code in the Unicode table. But not all of them, because there are too many possible combinations.
122
122
123
-
To support arbitrary compositions, Unicode standard allows us to use several Unicode characters: the base character followed by one or many "mark" characters that "decorate" it.
123
+
To support arbitrary compositions, the Unicode standard allows us to use several Unicode characters: the base character followed by one or many "mark" characters that "decorate" it.
124
124
125
125
For instance, if we have `S` followed by the special "dot above"character (code `\u0307`), it is shown as Ṡ.
In reality, this is not always the case. The reason being that the symbol `Ṩ` is "common enough", so Unicode creators included it in the main table and gave it the code.
170
+
In reality, this is not always the case. The reason is that the symbol `Ṩ` is "common enough", so Unicode creators included it in the main table and gave it the code.
171
171
172
172
If you want to learn more about normalization rules and variants -- they are described in the appendix of the Unicode standard: [Unicode Normalization Forms](https://www.unicode.org/reports/tr15/), but for most practical purposes the information from this section is enough.
0 commit comments