PHP urlencode python urlencode urlencode online conversion with UrlEncode function URL encoding

Source: Internet
Author: User
Tags rar alphanumeric characters
UrlEncode: Refers to the URL of the Web page in the Chinese characters of an encoding conversion, the most common is Baidu, Google and other search engines in the input of English Query time, generated through the Encode page URL.

UrlEncode generally have two ways, one is the traditional GB2312-based encode (Baidu, Yisou, etc.), the other is based on UTF-8 (Google, Yahoo and other uses).

This tool implements encode and decode in two ways, respectively:

Encode,%D6%D0%CE%C4, GB2312, Chinese

Encode,%e4%b8%ad%e6%96%87, UTF-8, Chinese

UrlEncode in HTML:

HTML file encoded as GB2312: http://s.jb51.net/. RAR---browser automatically converted to Http://s.jb51.net/%D6%D0%CE%C4.rar

Note: Firefox is not good for the Chinese URL of GB2312 encode because it defaults to UTF-8 encoding send URL, but ftp://protocol can, I tried, I think this should be a Firefox bug.

HTML file encoded as UTF-8: http://s.jb51.net/. RAR---browser automatically converted to Http://s.jb51.net/%E4%B8%AD%E6%96%87.rar

UrlEncode in PHP:

 
  

Except for "-_." All non-alphanumeric characters will be replaced with a percent percent "%" followed by a two-digit hexadecimal number.

The difference between UrlEncode and Rawurlencode: UrlEncode encodes a space as a plus "+", and Rawurlencode encodes a space as a plus "%20".

If you want to use UTF-8 's encode, there are two ways:

One, save the file as UTF-8 file, directly use UrlEncode, Rawurlencode can.

Second, use the Mb_convert_encoding function:

 
  

Instance:

 
  

UrlEncode in javascript:

such as:%e4%b8%ad%e6%96%87-_.%20%e4%b8%ad%e6%96%87-_.%20

encodeURI does not encode the following characters: ":", "/", ";", "?", "@" and other special characters.

The above describes the PHP urlencode function for URL coding in detail, including the urlencode aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.