If you read my last post, I showed you how to change over a MySQL database from Latin1 to UTF-8. In this post, I’ll show you how to complete the process of having your web pages actually use that UTF-8 encoding.
I’m going to be brief here – Okay, if you right click on virtually any web page and choose “View Source,” you will see a meta tag that looks something like this:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
(without those big spaces)
That meta tag is the declaration for which character encoding your web page will use. It’s pretty simple. All you need to do is to choose the character encoding that best fits the language your web page is written in. Many people these days are choosing UTF-8 because it’s what we call Unicode (any language).
If you are following my last post and are trying to change your site over to UTF-8 from Latin1, you most likely saw something like “latin1_swedish_ci” in your database. That was your table collation. Your current meta tag most likely looks something like:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
So, what do you do? That’s easy. Just swap out the “iso-8859-1″ in your web page meta tag with a “UTF-8.”
Now, if you have some weird characters on your web pages, they may change to something that looks like a diamond with a question mark in the middle of it. From my experience, that’s from people copying and pasting from some writing program like Microsoft Word. They are also caused by HTML special characters. You will need to edit those strange characters out of your text by using a website editing program of something even as simple as Notepad.
Questions/comments, leave them in the comment section and I will get back to you.
Incoming search terms
- webpage encoding