为您找到"
&??
"相关结果约100,000,000个
& is the way to represent an ampersand in most sections of an XML document. If you want to have XML displayed within HTML, you need to first create properly encoded XML (which involves changing & to &) and then use that to create properly encoded HTML (which involves again changing & to &). That results in: &
So an actual & got an & escape sequence to render an actual & because early parsers couldn't know if the & was the start of an escape sequence or just a literal &. There are many, many more. So when automated escapers and descapers do their thing with inputs and outputs, they sometimes screw up and will escape **&**amp; as **&**amp ...
When & is used in XML it shows as & whereas in HTML it is rendered as '&'. According to W3C Recommendations, a few entities are replaced ad other delimiters are replaced in an XML Document. Watch our Demo Courses and Videos
The & character is special in HTML because it starts a number of codes known as HTML Entities. To represent this special character, when writing HTML, you write & and the browser displays it as &.. If this or other HTML Entities are visible, that could indicate that the script or software which generates the page did not fully/properly decode whatever its data source is back to final form.
The problem with replacing the char is that there could be a mix of already-escaped ampersands alongside unescaped ampersands. & would become &. In addition to wrecking those, the primitive approach will also invalidate other legitimate escape sequences such as < and >-turning them into < and <.
& ampersand & < less than sign < > greater than sign > " the double quote sign " Appendix II lists a broad range of characters and symbols, relating their ISO names to the corresponding character codes in common character sets. They allow authors to include accented characters in 7-bit ASCII documents.
For example, & is escaped with &amp; Should ' be escaped with &#39;?"> That is correct as it can also result in unwanted side effects. e.g.
Ampersands are escaped like & If I write this HTML as Ampersands are escaped like &
it will be displayed as: Ampersands are escaped like & So I actually need to write:
Ampersands are escaped like &
which displays correctly as: Ampersands are escaped like &
decoding: & -> & So what could happen is "Write some text -> HTML encode -> put in database -> HTML encode again-> retrieve and display the text on page" - it could also happen if the text your were trying to put in the database was already HTML encoded to begin with.
Authors should use & (ASCII decimal 38) instead of "&" to avoid confusion with the beginning of a character reference (entity reference open delimiter). Share. Improve this answer. Follow answered Jun 30, 2011 at 11:47. John Conde ♦ John ...