I have a PHP function that generates an XML file from my data. Some of which was submitted via textarea fields.
When I create the XML file the textarea fields are displaying with an unusual carriage return at the end of the value. I've tried removing with the following methods, none of which do anything.
trim($value)
str_replace( "\n", "", $value)
str_replace( "\r", "", $value)
str_replace( "\n\r", "", $value)
str_replace( "\r\n", "", $value)
preg_replace('/\s\s+/', ' ', $value)
even tried strip_tags($value) and html_entity_decode($value) in case it was something weird i could strip out.
One thing that did remove it was removing all but alphanumeric characters via a regex but thats no use since my users will want to use a lot of characters like dashes, brackets, single and double quotes, etc.
Are there any other methods of removing weird characters like this? Or any other strange carriage returns that I can remove via code?