A Lesson in Encoding


Iím currently working on a responsive HTML5 template for my website…
[ZX81]

Still Celebrating Programing, Elsewhere!

Iíve paused updating this site to focus instead on my primary domain over at https://www.reids4fun.com. You can still read what crazy program Iíve published this month. Even better, read a few other articles!

NewsIím currently working on a responsive HTML5 template for my website. As much as I like the old one, it is starting to get a bit long in the tooth. Five years of life is a pretty good run, but it is time to get with the modern world full of mobile devices and tablets. Unfortunately, Iíve run into a bit of a pickle.

You see, I encoded my original site in Latin-1 or ISO-8859-1. Makes sense right? Okay, for those that donít know that is an encoding format. Basically it is how the browser interprets the characters you type. The problem is that my new template is UTF-8.

In and of itself, this isnít an issue. UTF-8 is what most websites use. It allows you to support a range of languages that use different characters. This is known as Unicode. The problem is that I had encoded my older files in ISO-8859-1, another unicode implementation. Basically, one template or the other displays things entirely wrong depending.

Because I havenít published the new template yet, it really shouldnít impact you. Except, however, that I already added a few articles using the new template. You will see some odd encodings because of that. Donít fret. Iím working to fix that problem. Please bear with me while I get through this.

One area that was really broken was my ZX81 listing. My past editors were actually set to use ISO-8859-1. But my latest editor, Atom, set the encoding to the standard UTF-8. Guess what, things didnít work so well. I could cut and paste between them and things would look right, but the site was all broken.

The fix was actually something simple. Convert to HTML entities instead. I basically removed all the special characters and encoded them instead. Guess what? It works now in both templates!

Now, I just need to figure out why sometimes my articles do the same, and other times they donít. Iíve noticed some oddities for sometime when editing articles. Sometimes they are all messed up. Iím pretty sure one is encoding correctly and one isnít. Time to add a new action item to my list.



Comments on this article:

No comments so far.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive