iconv_open 中文man页面

系统
iconv_open 函数 分配 一个 用于 把 fromcode 编码的 字符串转换成 tocode 编码 的 转换 描述符.

NAME

iconv_open - 分配一个字符集转换的描述符

总览 (SYNOPSIS)

#include <iconv.h>

iconv_t iconv_open (const char* tocode, const char* fromcode);

描述 (DESCRIPTION)

iconv_open 函数 分配 一个 用于 把 fromcode 编码的 字符串转换成 tocode 编码 的 转换 描述符.

fromcodetocode 所允许的值 以及 支持的 组合方式 都是 与系统 相关的. 对于 这个 libiconv 库, 它 支持 下面 的 编码, 也 支持 其所有 的 组合.

欧洲语言
ASCII, ISO-8859-{1,2,3,4,5,7,9,10,13,14,15,16}, KOI8-R, KOI8-U, KOI8-RU, CP{1250,1251,1252,1253,1254,1257}, CP{850,866}, Mac{Roman,CentralEurope,Iceland,Croatian,Romania}, Mac{Cyrillic,Ukraine,Greek,Turkish}, Macintosh
闪米特语言
ISO-8859-{6,8}, CP{1255,1256}, CP862, Mac{Hebrew,Arabic}
日文
EUC-JP, SHIFT-JIS, CP932, ISO-2022-JP, ISO-2022-JP-2, ISO-2022-JP-1
中文
EUC-CN, HZ, GBK, GB18030, EUC-TW, BIG5, CP950, BIG5-HKSCS, ISO-2022-CN, ISO-2022-CN-EXT
韩文
EUC-KR, CP949, ISO-2022-KR, JOHAB
Armenian
ARMSCII-8
Georgian
Georgian-Academy, Georgian-PS
泰语
TIS-620, CP874, MacThai
捞挝语
MuleLao-1, CP1133
越南语
VISCII, TCVN, CP1258
特定平台
HP-ROMAN8, NEXTSTEP
Full Unicode
UTF-8
UCS-2, UCS-2BE, UCS-2LE
UCS-4, UCS-4BE, UCS-4LE
UTF-16, UTF-16BE, UTF-16LE
UTF-32, UTF-32BE, UTF-32LE
UTF-7
JAVA
uint16_tuint32_t 表示的 Unicode
(其 字节顺序 和 对齐方式 与 具体 机器 有关) UCS-2-INTERNAL, UCS-4-INTERNAL
charwchar_t 表示的 与 区域设置 相关的 编码
(其 字节顺序 和 对齐方式 与 具体 机器 有关, 其 语意 与操作系统 和 当前 区域设置 中的 LC_CTYPE 有关) char, wchar_t

tocode 后面 加上 "//TRANSLIT" 表示, 当 在目标 字符集中 不能 表示 一个 字符 时, 就用 同其 相似 的 一个 字符 来 代替.

其 返回的 转换 描述符 可以 被 iconv 多次 使用. 只要 没有 用 iconv_close 将其 释放, 它 就是 有效的.

转换 描述符 包含了 转换的 状态. 在用 iconv_open 建立 一个 描述符时 状态为 初始态. iconv 会 改变 它的 状态. (这说明 一个 描述符不能在 多线程中 同时 使用.) 可以 把 NULL 作为 inbuf 传给 iconv 来 使其 回到 初始态.

返回值 (RETURN VALUE)

iconv_open 函数 返回 一个 新的 转换 描述符. 如果 发生 错误 则设置 errno 变量 同时 返回 (iconv_t)(-1).

错误 (ERRORS)

除了 一般的 错误, 还可能 有 下面的 错误:

EINVAL
此系统 不支持 从 fromcodetocode 的 转换.

遵循 (CONFORMING TO)

UNIX98

参见 (SEE ALSO)

iconv(3), iconv_close(3)

#p#

NAME

iconv_open - allocate descriptor for character set conversion  

SYNOPSIS

#include <iconv.h>

iconv_t iconv_open(const char *tocode, const char *fromcode);

DESCRIPTION

The iconv_open function allocates a conversion descriptor suitable for converting byte sequences from character encoding fromcode to character encoding tocode.

The values permitted for fromcode and tocode and the supported combinations are system dependent. For the GNU C library, the permitted values are listed by the iconv --list command, and all combinations of the listed values are supported.

The resulting conversion descriptor can be used with iconv any number of times. It remains valid until deallocated using iconv_close.

A conversion descriptor contains a conversion state. After creation using iconv_open, the state is in the initial state. Using iconv modifies the descriptor's conversion state. (This implies that a conversion descriptor can not be used in multiple threads simultaneously.) To bring the state back to the initial state, use iconv with NULL as inbuf argument.  

RETURN VALUE

The iconv_open function returns a freshly allocated conversion descriptor. In case of error, it sets errno and returns (iconv_t)(-1).  

ERRORS

The following error can occur, among others:

EINVAL
The conversion from fromcode to tocode is not supported by the implementation.

CONFORMING TO

UNIX98  

SEE ALSO

iconv(3), iconv_close(3), iconv(1)

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-25 16:57:51

iconv_close中文man

2011-08-25 14:19:52

open中文man

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-25 15:39:42

fcloseall中文man

2011-08-25 15:00:15

cfgetispeed中文man

2011-08-19 18:35:50

issue中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 17:40:25

setvbuf中文man

2011-08-23 14:21:16

poweroff中文man

2011-08-24 15:52:59

intro中文man

2011-08-23 13:40:31

2011-08-25 15:54:08

ferror中文man

2011-08-25 17:24:54

puts中文man

2011-08-25 18:34:55

ungetc中文man

2011-08-23 10:03:40

useradd中文man

2011-08-23 10:29:02

chpasswd中文man

2011-08-23 10:34:22

convertquot中文man
点赞
收藏

51CTO技术栈公众号