为您找到"
&&&
"相关结果约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:
If you want one to appear in text on a web page you should use the encoded named entity "&"—more technical mumbo-jumbo at w3c.org. While most web browsers will let you get away without encoding them, stuff can get dicey in weird edge cases and fail completely in XML.
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 ...
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 &
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 ...
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.
It may have converted a character twice. & -> & -> & When the browser receives the string "&", it performs the task of restoring the complete "entity" in the first 5 characters, resulting in "&" being output. Other possibilities is the encoding of the ampersand using a numerical character code, or omission of the semicolon.
For example, & is escaped with & Should ' be escaped with '?"> That is correct as it can also result in unwanted side effects. e.g.
& is "valid", though whether you want to use it is another question. If you're writing a document in XML, then & will be used to represent an ampersand. If your XML document is describing content that itself is encoded in a similar way -- e.g. HTML -- then that content could logically include an & itself. This could lead to a & in the XML.
& doesn't mean anything to test, it's the HTML entity for the ampersand &, which has a special meaning in HTML so it cannot be presented as-is. Where ever that snippet came from, the presentation is broken. Decoding that character, the line should be