Hi hopefully someone can help, i'm having a slight panic on a project I'm working on. I've got 90% of this all done but am having a few concerns regarding some special characters.
Heres' the situation. I have a database table i need to export to a CSV (so the client can then import into their own system) I've got this working a dream, downloads the file and all that perfectly.
Now i have a few fields in this table where we're going to get special characters (double quotes, single quotes etc) just the kind of thing that will bust a CSV from importing (or opening in excel/similar properly).
Basically what i could do with knowing is should i just clean the strings of the bad characters? possibly loosing some of the meaning of the data (for instance one field is a message, and this is likely to contain all sorts of characters), or is there something else i can do that will retain the data - i'm thinking the brute force clean could be fine, but would like to know my options.
Also could do with a hand with regards to cleaning the string, I've had a look at preg_replace, example here:
$fnameClean = preg_replace("/'/", "", $fnameDirty);
Really hope this is a simple one guys, thanks in advance.