The urlencode issue is strange.

Source: Internet
Author: User
Tags alphanumeric characters
Urlencode has a strange problem. I would like to use the urlencode function of php to output a string like this in the string "('baidu'): ('baidu ') % e4 % b8 % ad but the actual output is: % 28% 27 baidu % 27% 29. I am searching baidu for the keyword: online ur urlencode. this is a strange question. ask everyone
I want to use the urlencode function of php to output the string "('baidu')" ('baidu') % e4 % b8 % ad

But actually output: % 28% 27 baidu % 27% 29,

I search for keywords in Baidu: online url encoding. the third result is: a url encoding applet of the Baidu application, which can be output using utf8 encoding:

('Baidu') % e4 % b8 % ad. why?

Of course, it doesn't matter if the Chinese character "medium" in the string is generated differently, because my source code is utf8, so I am wondering how to make php
Does the urlencode () function not encode commas and parentheses?


------ Solution --------------------
String urlencode (string $ str)
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 (+ ).

Baidu is not strict. if you do not want transcoding parentheses, you can use str_replace ('% 28',' (', $ enstr) to replace the transcoding result.

------ Solution --------------------
Baidu is inaccurate. I used it.

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.