In this paper, we describe the way Python implements the Chinese translation URL encoding. Share to everyone for your reference, specifically as follows: today to deal with Baidu post-bar things. Want to make a list of keywords, each time you need to add directly to the list inside it. But added to the list is the case of Chinese (such as ' Lijiang '), the URL of the address code is '%e4%b8%bd%e6%b1%9f ', so need to do a conversion. Here we use the module URLLIB. >>> Import urllib>>> data = ' Lijiang ' >>> print data lijiang >>> data ' \xe4\xb8\xbd\xe6\xb1\x9f ' >>> Urlli
1. Python implements Chinese translation URL encoding
Introduction: This article mainly introduced the Python to implement the Chinese Translation URL encoding method, combined with the case form analysis Python to the Chinese GBK and the Utf-8 code conversion correlation skill, has the certain reference value, needs the friend to refer
2. PHP mb_convert_encoding Text Encoding conversion function Introduction _php tutorial
Introduction: Introduction to the conversion function of PHP mb_convert_encoding text encoding. Conversion of text Encoding mb_convert_encoding () mb_convert_encoding ($str, $encoding 1, $encoding 2) $str, to convert the encoded string $encoding 1, the target encoding, such as UTF-8,GBK, uppercase and lowercase are
3. In-depth parsing of mb_convert_encoding and ICONV functions in PHP _php tutorial
Introduction: In-depth parsing of mb_convert_encoding and ICONV functions in PHP. 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 no encoding in English
4. PHP automatically recognizes the character set and completes the transcoding _php tutorial
Introduction: PHP automatically recognizes the character set and completes the transcoding. Because they use the character encoding is generally utf-8 encoding, but if the other party's blog using gb2312 encoding, the post will appear garbled (unless the other party before the post-code conversion). In not
5. PHP functions: A simple way to determine character encoding _php tutorial
Summary: PHP functions: A simple way to determine character encoding. php function CHKBM ($string) {$BM = Array (ASCII, GBK, UTF-8), foreach ($bm as $c) {if ($string = = = ico NV (UTF-8, $c, Iconv ($c, UTF-8, $string))) {//conversion encoding is not equal Retu
6. The difference between mb_convert_encoding and iconv in PHP _php tutorial
Description: The difference between mb_convert_encoding and Iconv in PHP. 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 no coding question in English.
7. PHP using the Baidu Translation API sample sharing _php Tutorial
Introduction: PHP uses the Baidu translation API sample to share. Baidu Translation API PHP code, testing can be achieved, but English translation may need to convert the encoding. Copy the code as follows:? PHP function Language ($value, $from = "Auto", $to = "Auto") {$v
8. PHP iconv function transcoding in the resolution of truncation character problem, iconv truncation _php tutorial
Introduction: The resolution of truncation character problem when Iconv function is transcoded in PHP, Iconv truncation. PHP iconv function transcoding in the resolution of truncation character problem, Iconv truncation Iconv is the conversion code, but in the Chinese transcoding when the display is not complete problem. Copy the code code as follows
9. PHP header () function jump Invalid resolution
Introduction: When converting the encoding, there is a page that needs to declare the UTF-8 encoding in the head, but this conflicts with a header in the program. Google a bit, find several solutions, translation collation: If You got this message: "Warning:cannot Modify header Information-headers already sent by. .." If you are performing p
Python implements Batch conversion file encoding (Batch conversion encoding example)
Introduction: This article mainly introduces the Python implementation of batch conversion file Encoding example, specify the file encoding, directory or extension can be converted, please refer to the use of it
"Related question and answer recommendation":
The restful part of Python-django gives the client interface, I write Chinese in the code, is there a problem?
The problem of JAVASCRIPT-JS conversion coding
Python-beautifulsoup Use the Find_all method, how to convert the encoding?