En Fr
Web/database development and more...
« New feature: send message to authorWhy I consider (MVC) Smarty templating inefficient »

Charsets in MySQL 4.1

03.10.05

English (EU) Charsets in MySQL 4.1

Permalink 14:40:32, by Francois Planque Email , Categories: mySQL

Once you start messing with charsets in MySQL you eventually get to a situation where the default charset for your database is UTF-8 but you want to import old backups in their own charset, for instance ISO-LATIN-1.

But when you import it, MySQL thinks it's UTF-8 and all your specials chars get messed up.

Simple solution, add this at the end of your CREATE TABLE statements:

DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci

More in the MySQL Manual.

Note: this does not convert your data, this does tell MySQL that those particular tables are in another charset. I think, if you want to convert, you need to change the charset of your connection at the time you do the import (using the --default-character-set switch for example). Gotta re-check that though... but I think it can be overridden like this:

SET NAMES latin1

No feedback yet

Comments are closed for this post.