Login to download the latest version of Mint and your favorite Pepper, purchase additional licenses, or post in the Forum. Don't have an account? Create one!

In Partnership with Media Temple

Mint Forum

utf-8 vs. iso-8859-1

Kreg
Minted
Posted on Feb 02, '07 at 06:35 am

I use Mint for a blog where many of the post titles include French words with accented characters. In Mint, these accented characters appear malformed because Mint uses iso-8859-1 character encoding in it’s HTML header. I was able to fix the problem and get the characters to display correctly by switching to utf-8. So, in /mint/app/includes/head.php you would change

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

to

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

It’s a simple fix, but I thought the tip might be useful to other folks.

Thanks for sharing! I wasn’t aware that mint was not using
UTF-8 encoding

misu
Minted
Posted on Feb 02, '07 at 09:20 am

thxs for sharing :-)

Shaun Inman
Mint/Pepper Developer
Posted on Feb 02, '07 at 11:04 am

I’m not sure this will work in all instances. I’ve had trouble with encoding in the past because data is coming from a page, being passed through a query string, processed by PHP and stored in a database—all of which seem to encode things differently depending on which server the code is running on. This is why I settled on iso-8859-1, it resulted in the least problems. I don’t know enough about encoding to comment further.

Aha! this is what was happening to me since I upgraded to 2.0. Ok, for those who play with .htaccess, you can simply have this and be done with the whole of your site’s encoding.

AddDefaultCharset utf-8

I don’t know about what charset PHP uses, but for the MySQL stuff, it seems that by default to “latin1_swedish_ci”, at least with me on MediaTemple. What I think people who use non-English characters should do is switch this to UTF-8 in phpMyAdmin. I am not positive it will work but who knows. Just my opinion.

P.S.: You may have already tried this before Shaun and I don’t know if it will break anything on Mint, but you could replace your

TYPE=MyISAM;

with

TYPE = MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;

when creating the tables upon install. As well, if it doesn’t break anything, you could run this

ALTER TABLE `<Insert Table Name>` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci

to switch all the tables over to UTF-8 if they have already installed.

You must be logged in to reply. Login above or create an account