I am using PHPExcel for reading and storing data from Excel, but whenever I read a row from the Excel file to insert into the database, _x000D_
or x000D
is appended to the title column.
Example: when inserting, the title is 'Demo', and after reading back from the DB, it was converted to 'Demo_X00D_' or 'Demo X00D'.
Came across this today and I am using this to convert those escape sequences to html entities:
preg_replace('/_x([0-9a-fA-F]{4})_/', '&#x$1;', $string);
Which changes _x000D_
into 
You can take this a step further to render the actual character (which in this case is a carriage return)
html_entity_decode(preg_replace('/_x([0-9a-fA-F]{4})_/', '&#x$1;', $string));
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