Hello everyone,
I'm currently pulling some data from a SQL row that is used as the backend for a forum. I am placing this into a variable called lets say $variable1.
Now sometimes the post on the forums are different, for example on some posts people put in (if they copied and pasted) you will get this type of quotation mark: “ as opposed to ". Now this is only a problem when I display this row on a page because it comes out all messed up like this “I looked into the rear view mirror and I saw it leap across my trunk.â€
Any idea how I can fix this? I guess I have to run the string through a function to change the encoding but not sure where to start. Any help would be appreciated.
Regards,
TNT
Fix Encoding on Variable
Moderator: General Moderators
Re: Fix Encoding on Variable
What would be really nice is if you could use a good encoding for everything: HTML pages and database tables. An encoding that can handle characters like those smart quotes. If you got that set up correctly then you wouldn't have any problems like that.
That would take a bit of work on your part though, so
That would take a bit of work on your part though, so
Code: Select all
echo iconv("UTF-8", "ISO-8859-1", 'quotation mark: “ as opposed to "'); // probably