开发者

Why is nl_langinfo(CODESET) different from locale charmap?

开发者 https://www.devze.com 2022-12-08 14:29 出处:网络
This post originated from How do you get what kind of encoding your system uses in c/c++? I tried using

This post originated from How do you get what kind of encoding your system uses in c/c++?

I tried using

nl_langinfo(CODESET)

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?


You need to first call

setlocale(LC_ALL, "");

nl_langinfo always gives information about the current locale.

0

精彩评论

暂无评论...
验证码 换一张
取 消