InvoiceBerry Blog

Small Business | Invoicing | Marketing | Entrepreneurship | Freelancing

Charset UTF-8, Charset ISO-8859-1, the £ (Pound) sign, AJAX and Prototype…

Written by 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.

Try our online invoicing software for free

Send professional-looking invoices
Accept online payments with ease
Keep track of who's paid you

Start sending invoices

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.

But Javascript / AJAX (Prototype) only works on UTF-8.

So we found a way around it:

  • First go to your prototype.js file
  • search for “encoding”
  • you will find a line saying:

[php]encoding:     ‘UTF-8’,[/php]

  • change it to:

[php]encoding:     ‘ISO-8859-1’,[/php]

But this is not the end of the problem as Prototype is using the functions encodeURIComponent and decodeURIComponent to encode and decode special characters in the text.

By replacing all the encodeURIComponent functions to escape functions and all the decodeURIComponent functions to unescape function we solved the problem.

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.

Small Business Finance 101

Download our free guide to learn the fundamentals of finance that will help make your small business more efficient and successful.

Ready to start invoicing your clients with InvoiceBerry?

Sign up to our free trial account. No credit card required.

Sign Up Now
Read previous post:
Graphic Designers send simple invoices with Invoiceberry

The graphic designers over at Cup of 3 Design have used Invoiceberry from the very beginning to create their invoices....

We use cookies to give you a better experience. Check out our privacy policy for more information.