tags:

views:

240

answers:

1

I have some text stored in MySQL database like this "Tom gave Sarah £5 for her book". Up until last Monday this displayed on the site perfectly when pulled from the site, showing "Tom gave Sarah £5 for her book".

Now, even though I have not changed/installed/uninstalled/updated anything at all, it has stopped working.

The old values in the database are being displayed as "Tom gave Sarah £5 for her book". On the form that saves this text to database, where it used to save to database fine as "Tom gave Sarah £5 for her book", it is now saving as "Tom gave Sarah ?5 for her book", and displaying on the site as this as well ("Tom gave Sarah ?5 for her book").

What would cause this? I am pulling my hair out to try and sort this out. I have been playing with utf8_encode/utf8_decode and using ISO-8859-1 and UTF-8 character set for the pages and although each method produces different results (eg "?5" / "£5" / "£5" / "�5" / "☐5" ), none are right.

The problem can't be MySQL because I can see £ signs fine in phpMyAdmin and the £ signs work on a different web server.

Help!

+2  A: 

Instead of repeating this over and over again, I'm just gonna leave you with a link:

UTF-8 all the way through…


If you follow the steps mentioned in chazomaticus answer, your problems will be gone.

In your specific problem database / table / field encoding is probably the issue.

Alix Axel
Unfortunately if I change database to UTF-8 it messes things up on the web server that currently works fine, so don't want to do this.
Tim
@Tim: Then HTML encode the stuff before saving to the database and decode it when fetching. That's the only advice I can give you.
Alix Axel