[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [edict-jmdict] database schema



On 21/09/06, Pawel Szymczykowski <makenai@gmail.com> wrote:

Anyhow, I think you might be running into trouble because you didn't
specify a character set for the tables or columns. Try creating your
tables like this:

CREATE TABLE gloss (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY ,
    sens INT UNSIGNED NOT NULL REFERENCES sens (id) ON DELETE CASCADE ,
    ord MEDIUMINT NOT NULL ,
    lang TINYINT UNSIGNED NOT NULL REFERENCES kwlang (id) ,
    txt VARCHAR(2048) NOT NULL ,
    note TEXT ) TYPE=InnoDB CHARACTER SET utf8;

Setting a default for the whole database with

create database db_name character set utf8;

would be easier. An existing database can be altered with

alter database db_name character set utf8;

Just as an aside, other problems with utf8 and other encodings can
occur because of variables like 'character_set_client'. If these are
wrongly set up, even if the database itself is using utf8 internally,
it will mangle characters as they go in and out.