Question by ESCOBAR
I have tried a lot but nothing is working. I want to import a XML-file with PHP. In some strings the customer puts some ANSI-Code Carrier Returns (“ ”). I have tried to remove them with:
str_replace('r', '', $xml->description);
I also tried it with
"&\#13;" in the search but nothing works. Do you have any idea how to remove these linebreaks?
Answer by Corbin
Since your XML processor is already handling de-entitying the entities, you’ll be left over with plain ASCII n or r or rn. PHP does not handle r or n inside of single quotes. It only translates them to their respective characters (codes 10 and 13), when the r and n are inside of double quotes.
You just need to use “n” or maybe “rn”.