How to convert "garbled characters" into Chinese characters using php code

Source: Internet
Author: User
Tags form post alphanumeric characters
How can php use code to convert "garbled text" into Chinese characters, just like the Chinese in the address bar of Baidu? how can I convert such strings into Chinese ??? % E5 % 8C % 97% E4 % BA % AC what functions should I use to convert to Chinese ?? Help me... ------ solution ---------------------- urlencode-encode the URL string to return a string. how can php convert "garbled" to Chinese characters using code?
Just like the Chinese characters in the address bar of Baidu, how can I convert such strings into Chinese ???

% E5 % 8C % 97% E4 % BA % AC what functions should I use to convert to Chinese ?? Help me ....

------ Solution --------------------
Urlencode-encode a URL string

Returns a string -_. all other non-alphanumeric characters will be replaced with a semicolon (%) followed by two hexadecimal numbers, and spaces will be encoded as the plus sign (+ ). This encoding method is the same as that for WWW form POST data and the same as that for application/x-www-form-urlencoded. For historical reasons, this encoding is different from RFC1738 encoding (see rawurlencode () in space encoding as the plus sign (+. This function allows you to encode a string and use it in the request part of a URL. It also allows you to pass variables to the next page:
Echo '';
?>

Urldecode-decode the encoded URL string
Decodes any % # in the encoded string ##. Returns the decoded string.

$ A = explode ('&', $ QUERY_STRING );
$ I = 0;
While ($ I <count ($ )){
$ B = split ('=', $ a [$ I]);
Echo 'Value for parameter ', htmlspecialchars (urldecode ($ B [0]),
'Is, htmlspecialchars (urldecode ($ B [1]),"
\ N ";
$ I ++;
}
?>

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.