html, JavaScript, URL special characters escape interpretation and how to use the detailed

Source: Internet
Author: User



html, JavaScript, URL special character escapes in the actual programming are useful, some people on the use of special character escapes is not very clear, the following on the escape of Html,javascript,url special characters to do a description and induction.


HTML special character escapes


HTML special character escapes are formatted as follows:


&+ entity or ා plus entity + ";"
For example: & becomes & amp after escaping; 


Still remember just learn HTML that will, do page layout, need to use a lot of space, so you keep pressing the space to affect the layout, but see the effect has not changed. The reason is that when HTML encounters multiple spaces between two characters, it is parsed into a single space. There are students on the point, the space for & nbsp, and then copied a large number of & nbsp, the effect is realized, think of the original HTML is how simple.



The following are common HTML escape characters:


Character Description Escape character
" Double quotes
"
& & Symbols
&
< Less than
&amp;amp;amp;lt;
> Greater than
&amp;amp;amp;gt;
A blank grid that keeps on line
&amp;amp;amp;nbsp;
Single quotation marks
&amp;amp;amp;acute;
© Copyright
&amp;amp;amp;copy;
® Registered trademarks
&amp;amp;amp;reg;
Javascrpt Escape character


The following lists the commonly used escape characters in JavaScript


Escape sequences Character
\b Backspace
\f Go paper To change pages
\ n Line break
\ r Enter
\ t Horizontal Jump Grid
\‘ Single quotation marks
\" Double quotes
\\ Back slash


Note: The difference between line break (\ n) and carriage return (\ r)



The story of this thing comes from a typewriter, and there are two steps in the old typewriter to start a new line:


1. Type the head back to the starting position, this is the carriage return
2. Move the paper up one line, this is the line
URL special character escapes


When you submit the form by get, the browser will use the HTTP protocol to parse the URL parameters in the & symbol, and then upload to the server, the server gets the corresponding value. If the & character usage is unreasonable, the server will not get the corresponding value after the HTTP protocol parsing.



For example:


http://jahan.sinaapp.com/test.php?content= me and you//content= me and you
Http://jahan.sinaapp.com/test.php?content=i&you//content=i, you= ";


This violates our intentions, and what we want is i&you, so it is necessary to master and understand URL escapes.



URL special character encoding formula:


URL special character encoding formula =% + character ASCII (16 binary) code value
For example: The encoded value of a space is "%20".


Some URL special symbols and codes are listed in the following table.


Special characters Description 16 Binary values
+ The + sign in the URL denotes a space %2b
Space Spaces in the URL can be used with a + or code %20
/ Separating directories and subdirectories %2f
? Separating the actual URLs and parameters %3f
% Specify special characters %25
# Represents a bookmark %23
& Delimiter between the parameters specified in the URL %26
= The value of the specified parameter in the URL %3d


The above is a summary of HTML, JavaScript, URL special character escape or encoding



html, JavaScript, URL special characters escape interpretation and how to use the detailed


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.