Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is HTML Entity '
'?

Tags:

html

xml

I'm generating an XML Document object via the DOMDocument class. In the process, some kind of whitespace within elements is being converted into 
. It's pretty difficult to search for this one since search engines treat this character as whitespace.

How do I scrub this character out of my xml output, or at least replace it with a different, preferable whitespace character?

Thanks.

like image 974
ford Avatar asked Feb 22 '11 18:02

ford


People also ask

How do HTML entities work?

HTML entities work because the browser knows to display it as the relevant special character and to not treat it as a special character. All HTML entities start with an ampersand “&” and end with a semi-colon “;”.

Do I need to use HTML entities?

Generally, you don't need to use HTML entities if your editor supports Unicode. For some instances, entities can be useful: Your editor does not support Unicode. Your keyboard does not support the character you would like to type, such as em-dash or the copyright symbol.


2 Answers

ASCII code 13 corresponds to a carriage return (in PHP, it's "\r").

like image 131
BoltClock Avatar answered Oct 11 '22 08:10

BoltClock


You scrub this character out of your output by not putting it there in the first place. Look for the code that puts the carriage return in your XML, and delete it.

like image 38
Michael Kay Avatar answered Oct 11 '22 08:10

Michael Kay