Skip to content

Commit c4251c6

Browse files
committed
nit2
1 parent 63f6c90 commit c4251c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/unicode.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -934,12 +934,14 @@ std::string s = u8"你好";
934934

935935
|前缀|编码|字符类型|
936936
|----|----|--------|
937-
|"你好"|运行字符集 (ANSI)|`const char []`|
937+
|"你好"|运行字符集 (默认是开发者电脑的“区域设置”,而不是客户的)|`const char []`|
938938
|L"你好"|Windows 上 UTF-16;Linux 上 UTF-32|`const wchar_t []`|
939939
|u8"你好"|UTF-8|`const char8_t []`|
940940
|u"你好"|UTF-16|`const char16_t []`|
941941
|U"你好"|UTF-32|`const char32_t []`|
942942

943+
> {{ icon.tip }} 只不过是开发者和客户往往处于同一个地区,所以 `"你好"` 看起来好像可以直接输入到 `std::cout` 中一样。实际上他只是开发者电脑的 ANSI,而不是客户电脑的 ANSI,如果直接拿来打印,会导致以 `""` 常量形式写死的字符串会在客户电脑上出现乱码。除非这个字符串只包含 ASCII,因为所有 ANSI 都兼容 ASCII,才恰好避免了乱码。
944+
943945
## 选择你的阵营!
944946

945947
![](img/utfwar.png)

0 commit comments

Comments
 (0)