Hi, I read some data from a MySQL-database and dump this to a CSV-file. I see that there are some strange tailing blanks in the output. These appear not to be standard blank and I don't know how to remove them since neither rtrim or trim works. Since I don't know which character it is it is not straight forward to use str_replace.
I have attached a snip from the CSV-file. I hope it appears with the strange tailing blank in each column. Can anyone of you help me with this problem?
comes out as a regular space in your file.
how does the data get in to the db? what characterset is the db ?
If I try search/replace for conventional white space in a text editor (e.g. gEdit or something similar) the unwanted blanks are not removed/replaced.
The character set in the database is latin1_swedish_ci (old database that I really want to convert to unicode, but since it is not mine I cannot just do it).
They are non-breaking spaces (wiki link).
sorry looks like my txt editor converted your file first time around.
The following statements removed the unwanted non-breaking spaces:
$strRest = utf8_encode($strRest); $strRest = str_replace(" ", " ", $strRest); $strRest = str_replace(' "', '"', $strRest); $strRest = utf8_decode($strRest);
Thank you :-)