Iconv_open manual






















ICONV_OPEN (3) Linux Programmer's Manual ICONV_OPEN (3) NAME iconv_open - allocate descriptor for character set conversion SYNOPSIS #include 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 . 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. A complete iconv example. The example below features a solution for a common problem. Given that one knows the internal encoding used by the system for wchar_t strings, one often is in the position to read text from a file and store it in wide character buffers. One can do this using mbsrtowcs, but then we run into the problems discussed above.


For the libiconv implementation, they are listed in the iconv_open(3) manual page. Options controlling the input and output format: −f encoding, −−from−code=encoding. Specifies the encoding of the input. −t encoding, −−to−code=encoding. Specifies the encoding of the output. The iconv() function converts a sequence of characters in one character encoding to a sequence of characters in another character encoding. The cd argument is a conversion descriptor, previously created by a call to iconv_open(3); the conversion descriptor defines the character encodings that iconv() uses for the conversion. The inbuf argument is the address of a variable that points to the. A complete iconv example. The example below features a solution for a common problem. Given that one knows the internal encoding used by the system for wchar_t strings, one often is in the position to read text from a file and store it in wide character buffers. One can do this using mbsrtowcs, but then we run into the problems discussed above.


Internally, the iconv program uses the iconv(3) function which in turn uses gconv modules (dynamically loaded shared libraries) to convert to and from a character set. Before calling iconv(3), the iconv program must first allocate a conversion descriptor using iconv_open(3). The iconv() function converts a sequence of characters in one character encoding to a sequence of characters in another character encoding. The cd argument is a conversion descriptor, previously created by a call to iconv_open(3) ; the conversion descriptor defines the character encodings that iconv () uses for the conversion. 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.

0コメント

  • 1000 / 1000