Unescape decodeuri decodeuricomponent

Source: Internet
Author: User
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 escape.

Syntax
unescape(string)
Parameters Description
String Required. The string to be decoded or reversed.
Return Value

String is a decoded copy.

Description

This function works like this: Find the character sequence in the form of % XX and % uxxxx (X indicates a hexadecimal number ), use Unicode characters \ u00xx and \ uxxxx to replace such character sequences for decoding.

Tips and comments

Note: ecmascript V3 has removed the Unescape () function from the standard and is opposed to using it. Therefore, use decodeuri () and decodeuricomponent () instead.

Instance

In this example, we will use escape () to encode the string and then use Unescape () to decode it:

<script type="text/javascript">var test1="Visit W3School!"test1=escape(test1)document.write (test1 + "<br />")test1=unescape(test1)document.write(test1 + "<br />")</script>

Output:

Visit%20W3School%21Visit W3School!

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.