怎么在cagoc exchange发送邮件上查询

In linux terminal one would type
locale charmap
in order to see what kind of character-encoding your system uses, eg UTF-8.
My question is how would you do this using c/c++. (I'm using linux)
edit: 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?
解决方案 SETLOCALE(3)
Linux Programmer’s Manual
SETLOCALE(3)
setlocale - set the current locale
#include &locale.h&
char *setlocale(int category, const char *locale);
DESCRIPTION
setlocale() function is used to set or query the program’s current
NL_LANGINFO(3)
Linux Programmer’s Manual
NL_LANGINFO(3)
nl_langinfo - query language and locale information
#include &langinfo.h&
char *nl_langinfo(nl_item item);
DESCRIPTION
nl_langinfo()
function provides access to locale information in a
more flexible way than localeconv(3) does.
Individual
additional
the locale categories can be queried.
setlocale(3) needs
to be executed with proper arguments before.
Examples for the locale elements that can be specified
the constants defined in &langinfo.h& are:
CODESET (LC_CTYPE)
a string with the name of the character encoding used in
"ISO-8859-1",
"ANSI_X3.4-1968"
known as US-ASCII).
This is the same
string that you get with "locale charmap".
For a list of
acter encoding names, try "locale -m", cf. locale(1).
本文地址: &
在linux终端中,会输入
locale charmap
以查看您的系统使用什么样的字符编码,例如UTF-8。 我的问题是你将如何使用c / c ++。 (我正在使用linux)
编辑:我尝试使用
nl_langinfo(CODESET)
但是我得到了ANSI_X3.4-1968的UTF-8(这是我得到当输入:locale charmap)。我使用nl_langinfo()错了?
SETLOCALE (3)
- 设置当前语言环境 概要 #include& locale.h&
char * setlocale(int category,const char * locale);
DESCRIPTION
setlocale()函数用于设置或查询程序当前的语言环境。
NL_LANGINFO(3)Linux程序员手册NL_LANGINFO(3)
nl_langinfo
- 查询语言和语言环境信息 概要 #include& langinfo.h&
char * nl_langinfo(nl_item item);
DESCRIPTION
nl_langinfo()函数以比localeconv(3)更灵活的方式访问中的区域设置信息。可以查询语言环境类别的个人和额外的元素。 setlocale(3)需要才能使用适当的参数执行。 可以在item中使用指定的区域设置元素的示例在& langinfo.h&中定义的常量。是:
CODESET(LC_CTYPE)返回一个字符串,其中包含所选语言环境中使用的字符编码的名称,例如“UTF-8”,“ISO-8859 -1“或”ANSI_X3.4-1968“(更好地称为US-ASCII)。这是相同的字符串,你得到与“locale charmap”。有关char-
acter编码名称的列表,请尝试“locale -m”,cf. locale(1)。
本文地址: &
扫一扫关注官方微信

我要回帖

更多关于 c exchange发送邮件 的文章

 

随机推荐