为什么参阅nl_langinfo是(codeSET)从区域设置字符映射不同? [英] Why is nl_langinfo(CODESET) different from locale charmap?

查看:564
本文介绍了为什么参阅nl_langinfo是(codeSET)从区域设置字符映射不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个帖子来源于<一个href=\"http://stackoverflow.com/questions/1492918/how-do-you-get-what-kind-of-encoding-your-system-uses-in-c-c\">http://stackoverflow.com/questions/1492918/how-do-you-get-what-kind-of-encoding-your-system-uses-in-c-c

我试图用

nl_langinfo(CODESET)

但我得到ANSI_X3.4-1968而不是UTF-8(这是我得到打字的时候:区域设置字符表)。我使用了nl_langinfo()错了吗?我应该如何使用它呢?

but I got ANSI_X3.4-1968 instead of UTF-8 (which is what I get when typing: locale charmap). Am I using nl_langinfo() wrong? How should I use it?

推荐答案

您需要首先调用

setlocale(LC_ALL, "");

参阅nl_langinfo总是给人有关当前区域设置信息。

nl_langinfo always gives information about the current locale.

这篇关于为什么参阅nl_langinfo是(codeSET)从区域设置字符映射不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆