Today's project encountered the need to use JavaScript escape encoding Chinese characters and then use unescape decoding, the test Code section when there is a garbled situation.The details are as follows:First, open the test page with EditPlus test.
JavaScript scripts, including escape and Unescape, are usually used when URL transmission is performed. In. net, many people still want to use this function in C # and VB. NET, but they cannot find a simple implementation.
In fact, when we use.
Escape () is a coded function of JavaScriptExample: Var esstring=escape ("HelloWorld");In order to prevent data transmission in the read garbled phenomenon, the string is often to use the JS Escape () function to encode the string, and then in the
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
This example will show you how to escape and un-escape a value to be encoded in a URI and within HTML.
Require 'cgi' # Escapename = "Ruby? " Value = "Yes" URL = "Http://example.com /? "+ CGI. Escape (name) + '=' + CGI. Escape (value) +" & Var = t" #
PHP implements the escape and Unescape function code sharing in JavaScript, Escapeunescape
This class is pretty good. function, PHP to do JSON pass GBK characters, such as Chinese, Japanese, Korean god horse Unicode most suitable.
1) {//
Python handles HTML escape charactersIt is annoying to catch a string of HTML escape characters such as > or that are often encountered in grabbing web data.Let's say a string caught from a Web pagep = ' This can be handled in Python: Import' '
This article mainly introduces the HTML of the left and right angle brackets to escape into the form of two implementations, the need for friends can refer to the
In front-end development work, it is often necessary to escape the left and right
ArticleDirectory
Escape/Unescape
Encoding/Decoding
These scripts are intended to explain how to "hide" HTML and/or Javascript from other people who view your page's source code. it is not foolproof, but it does make it more difficult
In front-end development work, it is often necessary to escape the left and right angle brackets of HTML into solid form. We can not put ,& and so on directly in the final view of the page. It needs to be escaped before it can be displayed on 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.