提交 0cf50581 编写于 作者: R Rich Felker

fix nl_langinfo_l(CODESET, loc) reporting wrong locale's value

use of MB_CUR_MAX encoded a hidden dependency on the currently active
locale for the calling thread, whereas nl_langinfo_l is supposed to
report for the locale passed as an argument.
上级 57b97b42
...@@ -33,7 +33,7 @@ char *__nl_langinfo_l(nl_item item, locale_t loc) ...@@ -33,7 +33,7 @@ char *__nl_langinfo_l(nl_item item, locale_t loc)
int idx = item & 65535; int idx = item & 65535;
const char *str; const char *str;
if (item == CODESET) return MB_CUR_MAX==1 ? "ASCII" : "UTF-8"; if (item == CODESET) return loc->cat[LC_CTYPE] ? "UTF-8" : "ASCII";
/* _NL_LOCALE_NAME extension */ /* _NL_LOCALE_NAME extension */
if (idx == 65535 && cat < LC_ALL) if (idx == 65535 && cat < LC_ALL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册