File tree 4 files changed +11
-7
lines changed
4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -292,7 +292,7 @@ <h2 id="_1">前言</h2>
292
292
< blockquote >
293
293
< p > < img src ="./img/bulb.png " height ="30px " width ="auto " style ="margin: 0; border: none "/> 本书还在持续更新中……要追番的话,可以在 < a href ="https://github.com/parallel101/cppguidebook "> GitHub</ a > 点一下右上角的 “Watch” 按钮,每当小彭老师提交新 commit,GitHub 会向你发送一封电子邮件,提醒你小彭老师更新了。</ p >
294
294
</ blockquote >
295
- < p > 更新时间:2024年11月26日 12:26:35 (UTC+08:00)</ p >
295
+ < p > 更新时间:2024年11月26日 12:32:42 (UTC+08:00)</ p >
296
296
< p > < a href ="https://parallel101.github.io/cppguidebook "> 在 GitHub Pages 浏览本书</ a > | < a href ="https://142857.red/book "> 在小彭老师自己维护的镜像上浏览本书</ a > </ p >
297
297
< h2 id ="_2 "> 格式约定</ h2 >
298
298
< blockquote >
Original file line number Diff line number Diff line change @@ -421,7 +421,7 @@ <h2 id="index-_1">前言</h2>
421
421
<blockquote>
422
422
<p><img src="../img/bulb.png" height="30px" width="auto" style="margin: 0; border: none"/> 本书还在持续更新中……要追番的话,可以在 <a href="https://github.com/parallel101/cppguidebook">GitHub</a> 点一下右上角的 “Watch” 按钮,每当小彭老师提交新 commit,GitHub 会向你发送一封电子邮件,提醒你小彭老师更新了。</p>
423
423
</blockquote>
424
- <p>更新时间:2024年11月26日 12:26:35 (UTC+08:00)</p>
424
+ <p>更新时间:2024年11月26日 12:32:42 (UTC+08:00)</p>
425
425
<p><a href="https://parallel101.github.io/cppguidebook">在 GitHub Pages 浏览本书</a> | <a href="https://142857.red/book">在小彭老师自己维护的镜像上浏览本书</a></p>
426
426
<h2 id="index-_2">格式约定</h2>
427
427
<blockquote>
@@ -18357,11 +18357,13 @@ <h3 id="unicode-utf-8_4">UTF-8 派的跨平台软件何去何从?</h3>
18357
18357
setlocale(LC_ALL, ".utf-8"); // 设置标准库调用系统 API 所用的编码,用于 fopen,ifstream 等函数
18358
18358
SetConsoleOutputCP(CP_UTF8); // 设置控制台输出编码,或者写 system("chcp 65001") 也行,这里 CP_UTF8 = 65001
18359
18359
SetConsoleCP(CP_UTF8); // 设置控制台输入编码,用于 std::cin
18360
+ #elif __APPLE__
18361
+ // 通常来说 MacOS 的默认编码就是 UTF-8,这里设置全局 locale 是为了让 iswspace 接受全角空格、iswpunct 接受全角逗号 L',' 等
18362
+ setlocale(LC_ALL, "UTF-8"); // MacOS 设置 UTF-8 编码,让 iswspace 接受全角空格等
18360
18363
#elif __unix__
18361
18364
// 反正 Unix 系统默认都是 UTF-8,不设置也行,这里设置全局 locale 是为了让 iswspace 接受全角空格、iswpunct 接受全角逗号 L',' 等
18362
18365
//setlocale(LC_ALL, "zh_CN.utf-8"); // 设置使用中文本地化,可使 strerror 输出中文(但用户必须 locale-gen 过中文!)
18363
- //setlocale(LC_ALL, "C.utf-8"); // 设置使用语言中性 locale,只影响 iswspace、iswpunct 等函数,不会使 strerror 等输出中文
18364
- setlocale(LC_ALL, ".utf-8"); // 若不带任何前缀(推荐),则默认使用当前系统环境变量中的语言 $LANG,使 strerror 自动适应
18366
+ setlocale(LC_ALL, "C.utf-8"); // 设置使用语言中性 locale(推荐),只影响 iswspace、iswpunct 等函数,不会使 strerror 等输出中文
18365
18367
#endif
18366
18368
// 这里开始写你的主程序吧!
18367
18369
// ...
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -3066,11 +3066,13 @@ <h3 id="utf-8_4">UTF-8 派的跨平台软件何去何从?</h3>
3066
3066
setlocale(LC_ALL, ".utf-8"); // 设置标准库调用系统 API 所用的编码,用于 fopen,ifstream 等函数
3067
3067
SetConsoleOutputCP(CP_UTF8); // 设置控制台输出编码,或者写 system("chcp 65001") 也行,这里 CP_UTF8 = 65001
3068
3068
SetConsoleCP(CP_UTF8); // 设置控制台输入编码,用于 std::cin
3069
+ #elif __APPLE__
3070
+ // 通常来说 MacOS 的默认编码就是 UTF-8,这里设置全局 locale 是为了让 iswspace 接受全角空格、iswpunct 接受全角逗号 L',' 等
3071
+ setlocale(LC_ALL, "UTF-8"); // MacOS 设置 UTF-8 编码,让 iswspace 接受全角空格等
3069
3072
#elif __unix__
3070
3073
// 反正 Unix 系统默认都是 UTF-8,不设置也行,这里设置全局 locale 是为了让 iswspace 接受全角空格、iswpunct 接受全角逗号 L',' 等
3071
3074
//setlocale(LC_ALL, "zh_CN.utf-8"); // 设置使用中文本地化,可使 strerror 输出中文(但用户必须 locale-gen 过中文!)
3072
- //setlocale(LC_ALL, "C.utf-8"); // 设置使用语言中性 locale,只影响 iswspace、iswpunct 等函数,不会使 strerror 等输出中文
3073
- setlocale(LC_ALL, ".utf-8"); // 若不带任何前缀(推荐),则默认使用当前系统环境变量中的语言 $LANG,使 strerror 自动适应
3075
+ setlocale(LC_ALL, "C.utf-8"); // 设置使用语言中性 locale(推荐),只影响 iswspace、iswpunct 等函数,不会使 strerror 等输出中文
3074
3076
#endif
3075
3077
// 这里开始写你的主程序吧!
3076
3078
// ...
You can’t perform that action at this time.
0 commit comments