On 10/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi, > I want to store Chinese characters in my MySQL 4.1.11 through Django > but unluckily, like most novices, I get totally mess characters when > displaying them on utf-8 encoded templates. > After some investigation I found that the tables created by 'manage > syncdb' are actually encoded by 'latin-1'. After changing the character > set manually(using the 'alter table xxx convert to character set > 'utf8''), the characters were finely displayed:-) > > So, do I have to change my table encoding manually every time after > performing 'manage syncdb'? That must be very painful:(
A couple options: In your MySQL server configuration, you can set default-character-set = utf8 and then this will be used for your connection any any tables you create. Another option is to set the default character set on the database with CREATE DATABASE xxx CHARACTER SET UTF8. http://dev.mysql.com/doc/refman/5.0/en/alter-database.html You want to do this prior to creating tables, of course. ALTER DATABASE can be uased to set the default on an existing database, but doesn't affect existing tables. -- This message has been scanned for memes and dangerous content by MindScanner, and is believed to be unclean. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---