Skip to content

Commit 2d01cda

Browse files
author
uuufa
committed
unix 系统 setlocale 示例错误
1 parent 900b641 commit 2d01cda

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/unicode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,7 @@ int main() {
28522852
// 反正 Unix 系统默认都是 UTF-8,不设置也行,这里设置全局 locale 是为了让 iswspace 接受全角空格、iswpunct 接受全角逗号 L',' 等
28532853
//setlocale(LC_ALL, "zh_CN.utf-8"); // 设置使用中文本地化,可使 strerror 输出中文(但用户必须 locale-gen 过中文!)
28542854
//setlocale(LC_ALL, "C.utf-8"); // 设置使用语言中性 locale,只影响 iswspace、iswpunct 等函数,不会使 strerror 等输出中文
2855-
setlocale(LC_ALL, ".utf-8"); // 若不带任何前缀(推荐),则默认使用当前系统环境变量中的语言 $LANG,使 strerror 自动适应
2855+
setlocale(LC_ALL, ""); // 若使用空字符串(推荐),则默认使用当前系统环境变量中的语言 $LANG,使 strerror 自动适应
28562856
#endif
28572857
// 这里开始写你的主程序吧!
28582858
// ...

0 commit comments

Comments
 (0)