gpt4 book ai didi

c - 在 C 中获取当前语言环境的字符集?

转载 作者:太空狗 更新时间:2023-10-29 17:11:26 25 4
gpt4 key购买 nike

如何在 C 中找到当前语言环境的字符集?

setlocale(LC_ALL, NULL) 返回“en_US.UTF8”,但有没有办法获取字符集?在我系统的/etc/locale.gen 中,它列出了语言环境和字符集,因此它不在名称中。

最佳答案

您可以使用 nl_langinfo(3) 查询当前语言环境的各种参数功能。字符集通过调用 nl_langinfo(CODESET) 获得。

请注意,在使用 nl_langinfo 让您的程序识别区域设置之前,您必须调用 setlocale

关于c - 在 C 中获取当前语言环境的字符集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7644562/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com