아래는 Euc-Kr을 Utf-8로 변환하는 예제.
static int UTF8toEUCKR( char *outBuf, int outLength, char *inBuf, int inLength )
iconv_t cd = iconv_open( "EUC-KR", "UTF-8" );
int ires = (int)iconv( cd, &inBuf, (size_t*)&inLength, &outBuf, (size_t*)&outLength );
캐릭터 인코딩 변환 라이브러리.
For historical reasons, international text is often encoded using a language or country dependent character encoding. With the advent of the internet and the frequent exchange of text across countries – even the viewing of a web page from a foreign country is a “text exchange” in this context -, conversions between these encodings have become important. They have also become a problem, because many characters which are present in one encoding are absent in many other encodings. To solve this mess, the Unicode encoding has been created. It is a super-encoding of all others and is therefore the default encoding for new text formats like XML.
Still, many computers still operate in locale with a traditional (limited) character encoding. Some programs, like mailers and web browsers, must be able to convert between a given text encoding and the user’s encoding. Other programs internally store strings in Unicode, to facilitate internal processing, and need to convert between internal string representation (Unicode) and external string representation (a traditional encoding) when they are doing I/O. GNU libiconv is a conversion library for both kinds of applications.