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.
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 “;”.
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.
ASCII code 13 corresponds to a carriage return (in PHP, it's "\r"
).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With