Libiconv in gblic-Linux general technology-Linux programming and kernel information. The following is a detailed description. With the development of web applications, we often need to convert the encoding format. Libiconv, which started with debian, can be applied on various platforms. This library is a good news for C/C ++ code, saving the trouble of code conversion. The shell has the iconv command, the specific usage is iconv-f UTF-8-t GBK from.txt-o to.txt. is encoded into GBK(to.txt ). this lib supports almost all encoding formats in the world, and is very powerful. However, it is important to note whether the two encoding formats define the text you want to convert. Otherwise, you will fail!
The header file of the library is included in iconv. h. The simple usage is as follows:
The common error is illegal input sequence at position. This indicates that the string you provide is not the encoding format to be converted, or you contain text not included in the character set. For example, if you use the Chinese characters in GBK as GB2312, the conversion will fail.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service