when crawling HTML pages, there are always different encodings, and we don't usually do one by one of these encodings, but instead collectively convert them into the same code and easily mount the database. At this point, Iconv becomes a very
During encoding and conversion on Linux, you can use both the iconv function family programming and the iconv command, but the latter is for files, converts a specified file from one encoding to another.
I. Use the iconv function family for
Original article link
Description
The iconv command is used to convert the file encoding method (convert encoding of given files from one encoding to another). For example, it can convert utf8 encoding to gb18030 encoding, which is the opposite.
Http://hi.baidu.com/netwrom/blog/item/8885f31ef0d09ae7e1fe0b1c.html
On many UNIX-like platforms, there is an iconv tool that can be used to convert character encoding. For common text files, the file command can be used to detect the
Mb_convert_encoding This function is used to convert the encoding. It turns out that the concept of program coding is not understood, but it seems to be a bit enlightened now. However, there is generally no coding problem in English, only the
In development, we often need to change the N-file encoding, ICONV can only make changes to a single file, how to do? Let's write a shell script to solve this problem.
Example one: Using shell script to implement bulk transcoding operation.
#!/
The gb2312 and UTF-8 interchange functions of the iconv library are not required. A gb2312.txt (184799 bytes) is indeed too large and must be converted to unicode. This table is 51965 bytes, which is much smaller. Gb2312.txt (184799 bytes), which
File encoding conversion iconv1. The iconviconv command is used to convert the file encoding. When encountering a gbk-encoded file, you need to convert it to utf8 and use this command directly. 2. Usage iconv -- list: list the iconv-supported
Since the conversion of the two linux tools convmv and iconv to the ubuntu platform, the file names of a large number of mp3 files that were originally stored Under SUSE have been garbled, today, I found two linux tools convmv and iconv on the
I have found the iconv substitution function online. I don't have a comparison table. I 'd like to find one. I 'd better try it myself. please send me an email address, amani1234 # 21cn.com. thank you, PHPcode/****************************** // GB to
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.