Difference between decodeURI () and decodeURIComponent () in JS, decodeuricomponentAbstract:This article introduces two decoding functions: decodeURI () and decodeURIComponent (). These two functions can decrypt the cryptographic strings generated
Before we introduce the encodeURI (), encodeURIComponent (), decodeURI (), decodeURIComponent () methods, we need to understand the concept of the global object:The global (Global) object can be said to be the most special object in ECMAScript,
Summary:This article is about two decoding functions, they are the decodeURI () and decodeURIComponent () functions, these two functions can be generated by a particular function of the cryptographic string decryption operation, it can be produced
URL passing parameters are common data passing methods. However, if you do not pay attention to them, they are also prone to problems.
The most common problem is that URL transmission contains Chinese garbled characters and spaces are transcoded.
These URI methods encodeURI, encodeURIComponent (), decodeURI (), decodeuricomponent () Replace the Escape () and unescape () methods of the BOM. URI methods are preferable because they encode all Unicode symbols, whereas the BOM method can encode
The unescape () function decodes a string encoded by escape ().GrammarUnescape (String) string is required. The string to decode or reverse.return valueA copy of the string that was decoded.DescriptionThis function works by finding a sequence of
Transfer from Http://blog.jhonse.com/archives/2032.jhonseRecently in the use of the CI framework, found a problem, the URL of the Get link, if the Chinese characters, there will be problems, hint: Link characters do not pass, so in the Internet to
decodeURI () Definition and usage: the decodeURI () function decodes a URI encoded by the encodeURI () function.Syntax: decodeURI (uristring)Parameter description: Uristring required, a string containing the URI group to decode or other text to
In ASP (server. urlencode), PHP (urlencode () function encoding results, or through ASP, PHP and other dynamic languages directly write Chinese characters of cookies, when reading with JS, the encoding problem is that the final string is encoded by
decodeURI () Definition and usage: the decodeURI () function decodes a URI encoded by the encodeURI () function.Syntax: decodeURI (uristring)Parameter description: Uristring required, a string containing the URI group to decode or other text to
JS to encode the text involves 3 functions: Escape,encodeuri,encodeuricomponent, the corresponding 3 decoding function: unescape,decodeuri,decodeuricomponent1, passing parameters need to use encodeuricomponent, so that the combined URL will not be #
Turn from: http://blog.csdn.net/maxracer/article/details/7030903
decodeURI () Definition and usage: the decodeURI () function decodes the URI encoded by the encodeURI () function.Syntax: decodeURI (uristring)Parameter description: Uristring
The decodeURIComponent () function decodes the URI encoded by the encodeURIComponent () function.
decodeURIComponent (uristring) parameter descriptionuristring required. A string that contains the encoded URI component or other text to decode.
In addition to encodeuri (), encodeuriconponent (), and decodeuri () decodeuricomponent ()
Although not commonly used, it is very convenient to use in some cases. Definition and usage
The Unescape () function can decode strings encoded by
JavaScript (Urldecodedecodeuricomponent ()) This function name is too often, the individual really do not understand, after all, JS system functions are many, it is easy to miss. Trouble found this function by accident!Encoding function:
Recently made an upload progress bar module, need to get the return URL, but helpless, obtained is garbled, so on the server side of the return URL to encode encoding, and then decoding in JS, a start to use is decodeURI (), as shown, found that
The perfect solution for ASP UrlDecode.Uploadify 3 version, with formdata additional transmission parameters, with ASP parsing garbled. Think of a way to pass the first encodeuricomponent code. ASP is received and then decoded.Script
encodeURIComponent
Encodes a text string as a valid component of a Uniform Resource Identifier (URI).
encodeURIComponent (encodeduristring)
The required encodeduristring parameter represents an encoded URI component.
Description
The
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.