Basic concepts of 1.URL codingURLs can only be sent over the Internet using the US-ASCII character set. Because URLs often contain characters outside of the ASCII collection, URLs must be converted to valid ASCII formats. URL encoding uses a "%"
JavaScript itself uses the charCodeAt method to obtain Unicode encoding of a character and converts Unicode encoding into corresponding characters through the fromCharCode method.The charCodeAt method, however, should be a 16-bit integer that takes
Unicode Character Set is the most comprehensive character set in the world. It contains almost all the characters in the world. In fact, it can be understood that the Unicode Character Set is a huge table that orchestrates the characters and
UTF encoding
The UTF-8 is to encode the UCS as a 8-bit unit. The encoding from UCS-2 to UTF-8 is as follows:
UCS-2 encoding (16 binary)
UTF-8 byte stream (binary)
0000-007f
0xxxxxxx
0080-07ff
110xxxxx 10xxxxxx
0800-ffff
1110xxxx 10xxxxxx
The encodeURI () function encodes a string as a URI.GrammarencodeURI (uristring)
Parameters
Description
Uristring
Necessary. A string that contains the URI or other text to encode.
return valueA
UTF code
The UTF-8 is to encode the UCS in 8-bit units. The encoding method from UCS-2 to UTF-8 is as follows:
UCS-2 encoding (16-in-system)
UTF-8 byte stream (binary)
0000-007f
0xxxxxxx
0080-07ff
110xxxxx 10xxxxxx
0800-ffff
1110xxxx 10xxxxxx
In this paper, we describe the method of Base64 encoding for utf-8 of Chinese strings by JS. Share to everyone for your reference, specific as follows:
String to encode: "Select username from user"
Using Java for encoding, Java programs:
Php URL decode function corresponding to JavaScript URL encode function
1. Try using JS's encodeURI (), encodeURIComponent (), Escape () function for URL encoding,2. Using PHP UrlDecode function decoding, the results can not be decoded into normal
Js UTF-8 to pass the Chinese parameters to GBK, the reason is not because the character length is different, 1 Chinese in the UTF-8 for 3 characters, while GBK is 2 characters, therefore, the encoding content after encodeURL is inconsistent.
To
Topic: The UTF-8 encoding string into GB2312 encoding, no corresponding encoding string into # DEC; pattern. For example, = #54924; language: PHP, Javascript content: The browser uses the encodeURI function in Javascript to convert strings
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.