PHP UrlEncode Related issues

Source: Internet
Author: User
UrlEncode Problems with PHP
The following test page is available
PHP Code
  
   
  
   

Accessing xxx.php?name= Data Structures
Different browsers return the results are actually different!
The output in firefox7 and IE9 is%ca%fd%be%dd%bd%e1%b9%b9, and the output under Chrome is%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84!!
Why is the UrlEncode function processed in PHP and the results are related to the browser?

Another problem is that I want to make a simple form, method for Get
But when the text is in Chinese, it will automatically encode, assuming that the "data structure", the result of the code is%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%84. The result is the same as the encodeuricomponent processing of JavaScript.
And I need to get%ca%fd%be%dd%bd%e1%b9%b9 (that is, PHP's UrlEncode) in PHP-side processing.
How do you deal with such a thing, please? Or so, if it is the result obtained from encodeURIComponent, how to deal with UrlEncode result.

------Solution--------------------
Hmm,%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%84.
This is the result of UrlEncode after garbled. Convert the encoding format.
------Solution--------------------
discuss
Because you are sending values through a URL, and the browser has an option "Always send with Utf-8 encoding"

%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%84 is the URL encoding of the data structure UTF-8 encoding
and
%CA%FD%BE%DD%BD%E1%B9%B9 is the URL encoding of the data structure GBK encoding
  • 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.