Charset UTF-8, Charset ISO-8859-1, the £ (Pound) sign, AJAX and Prototype…Written by Uwe on April 18, 2011
We know everyone says to use UTF-8 as charset. But what happens when you can’t? When your web host won’t change it? When the client does not want it? Would you just prefer to use the good old ISO-8859-1?
Well then join the club. We have everything working on ISO-8859-1 and so far everything is perfect. By using this charset we support not only the pound sign (£), but also latin and French letters and German umlaut which are not supported by UTF-8.
But recently we found out that by posting a form on InvoiceBerry the pound sign (£) was not showing up the right way. Instead it showed up as Â£.
The problem is that even though we thought everything runs on ISO-8859-1, our AJAX did not. Our apache web server runs on the right charset. HTML, PHP, everything right. Everything has charset set as ISO-8859-1.
So we found a way around it:
- First go to your prototype.js file
- search for “encoding”
- you will find a line saying:
- change it to:
Now your entire system runs on the charset ISO-8859-1 and the pound sign (£) will be displayed correctly.
Please leave a comment or e-mail us to let us know if you have any problems along your way. Or if you are in London, why not pop into our office in Silicon Roundabout.