Hi I tried to insert russian language to mysql db but after inserting ,I am getting some strange things in database

INSERT INTO table(adtex) VALUES('1с бухгалтерия 7 Cкидка 42% на 1С:Предприятие 8 базовые версии!');

Output

adtex |
+----------------------------------------------------+
| 1? ??????????? 7 C????? 42% ?? 1?:??????????? 8 ??


Plz guide me

Recommended Answers

All 4 Replies

What collation does your database and table use ?

You have to make sure that all components of the process of inserting your russian language strings use the same encoding. The database, tables and columns should be encoded with the utf-8 character set. Also your connection to the database - be it with the native mysql command line client, an access client like navicat or HeidiSQL, or a script language like PHP - has to set its connection character set properly. Only then the data are stored and retrieved as intended.

Hi Can u plz give me an eg

Is it like this

For creating db : CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;

for creating table : CREATE TABLE an(languagename text,languagetext VARCHAR(90) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;


For inserting into db:LOAD DATA LOCAL INFILE '~/Desktop/ru.csv' INTO TABLE an FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';

Use the character set clause in the load data command:

The character set indicated by the character_set_database system variable is used to interpret the information in the file. SET NAMES and the setting of character_set_client do not affect interpretation of input. If the contents of the input file use a character set that differs from the default, it is usually preferable to specify the character set of the file by using the CHARACTER SET clause, which is available as of MySQL 5.1.17. A character set of binary specifies “no conversion.”

http://dev.mysql.com/doc/refman/5.1/en/load-data.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.