Jump to content

[Wiki] [solved] Dealing with unicode in mysql


Recommended Posts

Posted

Whats the best table encoding to store non-ansi characters like the ones below.

CREATE TABLE `dbc_DeclinedWord` (
   `Col0` BIGINT NOT NULL DEFAULT '0',
   `Col1` TEXT NOT NULL)
ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Export of DeclinedWord';
INSERT INTO `dbc_DeclinedWord` VALUES
(741,"Косматый молодой волк");
INSERT INTO `dbc_DeclinedWord` VALUES
(742,"Кролик");
INSERT INTO `dbc_DeclinedWord` VALUES
(743,"Трогг Каменной Челюсти");

When these are imported into MYSQL they display corrupted

Posted

found the solution.....

define the table using the following:-

DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci

and also execute this before importing any data:-

SET NAMES UTF8;

  • 1 month later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use