iconv_open

Allocates a descriptor for a codeset conversion.

Library:LibC
Classification:POSIX
Service:Environment Variable

Syntax

  #include <iconv.h> 
   
  iconv_t  iconv_open (
     const char   *tocode,
     const char   *fromcode);
  

Parameters

tocode

(IN) Points to a string representing a codeset that the input string is to be converted to with the iconv function.

fromcode

(IN) Points to a string representing a codeset that expresses the input string passed to the iconv function.

Return Values

If successful, returns a codeset descriptor. Otherwise, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

5

ENOMEM

Insufficient storage space is available.

9

EINVAL

The conversion specified is not supported.

10

ENFILE

Too many files are currently open in the system.

11

EMFILE

The calling process has too many file descriptors open.

Remarks

You use the descriptor returned by iconv_open in the iconv function to specify how you want a string converted from one codeset to another. The descriptor remains valid until closed with the iconv_close function.

The following strings can be used to specify a codeset in both the tocode and fromcode parameters.

Code Page

Supported Strings

437

"Cp437"

"437"

874

"th"

"Thai"

"Cp874"

"874"

932

"ja"

"Japanese"

"SJIS"

"932"

936

"zh_cn"

"Chinese"

"GB2312"

"936"

949

"ko"

"Korean"

"Cp949"

"949"

950

"zh_tw"

"Cp950"

"950"

950

"zh"

1250

"cs"

"Czech"

"ISO-8859-2"

"1250"

1250

"hu"

"Hungarian"

1250

"hr"

"Croatian"

1250

"pl"

"Polish"

1250

"ro"

"Romanian"

1250

"sr"

"Serbian"

1250

"sk"

"Slovak"

1250

"sl"

"Slovenian"

1250

"sq"

"Albanian"

1251

"bg"

"Bulgarian"

"ISO-8859-5"

"1251"

1251

"be"

"Byelorussian"

1251

"mk"

"Macedonian"

1251

"ru"

"Russian"

1251

"uk"

"Ukrainian"

1252

"ca"

"Catalan"

"ISO-8859-1"

"1252"

1252

"de"

"German"

1252

"da"

"Danish"

1252

"en"

"English"

1252

"fi"

"Finnish"

1252

"fr"

"French"

1252

"es"

"Spanish"

1252

"is"

"Icelandic"

1252

"it"

"Italian"

1252

"nl"

"Dutch"

1252

"no"

"Norwegian"

1252

"pt"

"Portuguese"

1252

"sv"

"Swedish"

1253

"el"

"Greek"

"ISO-8859-7"

"1253"

1254

"tr"

"Turkish"

"ISO-8859-9"

"1254"

1255

"he"

"Hebrew"

"ISO-8859-8"

"1255"

1255

"iw"

"Hebrew"

1256

"ar"

"Arabic"

"ISO-8859-6"

"1256"

1257

"et"

"Estonian"

"ISO-8859-1"

"1257"

1257

"lv"

"Latvian"

"ISO-8859-2"

1257

"lt"

"Lithuanian"

See Also