UrlEncode Rawurlencode Htmlspecialchars htmlentities

Source: Internet
Author: User
Tags base64 form post urlencode alphanumeric characters

W

String urlencode ( string $str )

Returns a string in which all non-alphanumeric characters except -_ are replaced with a percent sign (%) followed by a two-digit hexadecimal number, and a space is encoded as a plus (+). This encoding is the same as the WWW form POST data, and is encoded in the same way as the application/x-www-form-urlencoded media type. For historical reasons, this encoding is encoded with a space as a plus sign (+).   RFC3896 encoding (see Rawurlencode ()) is different.

String rawurlencode ( string $str )

Returns a string that all non-alphanumeric characters except -_ in this string are replaced with a percent (%) followed by a two-digit hexadecimal number. Is this in? The encoding described in RFC 3986 is intended to protect the literal characters from being interpreted as a special URL delimiter, while protecting the URL format from being confused by the transfer of media (like some messaging systems) using character conversions.

String htmlspecialchars ( string $string [, int $flags = Ent_compat | ent_html401 [, string $encoding = Ini_get ("Default_charset") [, bool $double_encode = True]]])

Certain types of characters have special uses in HTML, and they need to be expressed as HTML entities if they are to be retained. This function returns the expression after character escapes. To convert all the associated name entities in a substring, use htmlentities () instead of this function.

If the character encoding of the passed-in character is consistent with the final document, the input processed with the function is appropriate for most HTML document environments. However, if you enter a character encoding that is not the same as the document that eventually contains the characters, you want to preserve the character (in the form of a number or name entity), this function and htmlentities () (the substring corresponding to the encoded name entity) may not be sufficient.   This can be used instead of mb_encode_numericentity ().

string htmlentities ( string $string [, int $flags = Ent_compat | ent_html401 [, string $encoding = Ini_get ("Default_charset") [, bool $double_encode = True]]])

All aspects of this function are the same as Htmlspecialchars (), except that htmlentities () converts all characters that have HTML entities.

If you want to decode (reverse operation), you can use html_entity_decode ().

string base64_encode ( string $data )

Encode using the base64 pair data .

This encoding is designed so that binary data can be transmitted through a non-pure 8-bit transport layer, such as the body of an e-mail message.

base64-encoded data takes up about 33% more space than the original data.

UrlEncode Rawurlencode Htmlspecialchars htmlentities

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.