So, do I have to change my table encoding manually every time after
performing 'manage syncdb'? That must be very painful:(
Thanks
Best Regards,
Lin
If you want to run any set of SQL commands each time you create the
tables for a model, Django has support for this. Have a look at
http://www.djangoproject.com/documentation/model_api/#providing-initial-sql-data . That talks about providing some initial data for your tables, but you can include anything in there, including "ALTER TABLE..." statements. In fact, you probably want to set this up using the section immediately after the one I linked to -- where you can ensure the commands only run for MySQL.
Regards,
Malcolm
--place initial data commands here, alter tables, whatever
Also, since django uses utf-8 from top to bottom, it makes sense to
make utf-8 an option for the database, or at least be able to specify
it in a Meta directive in a model class...
Should I post this in a ticket ? Hey, maybe I'll even write a patch
about it! I'm so excited about django, I want to give back!
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.
I have also a problem with MySQL utf8 coding
I use MySQL database with utf8 character set and utf8_czech_ci
collation.
It works well on Linux server( with mod_python) but when I try to
export the data and import into the same Django
application but running on XP machine with runserver ,the utf8 is
gone.Instead of a proper coding there are some strange characters.
How can I solve the problem?