We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8542c17 commit f8e9aa8Copy full SHA for f8e9aa8
docs/unicode.md
@@ -2848,6 +2848,9 @@ int main() {
2848
setlocale(LC_ALL, ".utf-8"); // 设置标准库调用系统 API 所用的编码,用于 fopen,ifstream 等函数
2849
SetConsoleOutputCP(CP_UTF8); // 设置控制台输出编码,或者写 system("chcp 65001") 也行,这里 CP_UTF8 = 65001
2850
SetConsoleCP(CP_UTF8); // 设置控制台输入编码,用于 std::cin
2851
+#elif __APPLE__
2852
+ // 通常来说 MacOS 的默认编码就是 UTF-8,这里设置全局 locale 是为了让 iswspace 接受全角空格、iswpunct 接受全角逗号 L',' 等
2853
+ setlocale(LC_ALL, "UTF-8"); // MacOS 设置 UTF-8 编码,让 iswspace 接受全角空格等
2854
#elif __unix__
2855
// 反正 Unix 系统默认都是 UTF-8,不设置也行,这里设置全局 locale 是为了让 iswspace 接受全角空格、iswpunct 接受全角逗号 L',' 等
2856
//setlocale(LC_ALL, "zh_CN.utf-8"); // 设置使用中文本地化,可使 strerror 输出中文(但用户必须 locale-gen 过中文!)
0 commit comments