0

i have installed WAMP in my laptop & i have created a mysql table

CREATE TABLE `users` (
  `uname` varchar(20) NOT NULL,
  `pass` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`uname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

the column property of the table is shown here enter image description here when i insert a hindi unicode using

SET NAMES utf8;
insert into users(uname, pass) values ('सूरज','abc');

the content of the table is shown here

enter image description here

the unicode word सूरज does not shown properly. where i have done wrong ?

Linendra Soni
  • 170
  • 1
  • 10

3 Answers3

2

Here the problem is the SQL admin program like toadformysql, mysql-workbench-community etc. is not compatible to insert the unicode characters properly. Other program like SQLyog, phpMyAdmin etc. provide compatibility to insert the unicode characters properly into the mysql table/database.

The solution for this problem is to use the compatible SQL Admin application
Linendra Soni
  • 170
  • 1
  • 10
0

You should change to utf8 multibyte with.

ALTER TABLE `users` CHARSET=utf8mb4, COLLATE=utf8mb4_bin; 

Query

SELECT * FROM users

Result

uname         pass    
------------  --------
सूरज          abc    

demo http://www.sqlfiddle.com/#!9/4c5b37/1

Raymond Nijland
  • 11,488
  • 2
  • 22
  • 34
0

Probably the connection parameters are missing any specification of UTF-8.

Read Trouble with UTF-8 characters; what I see is not what I stored , especially the parts about "best practice", "debugging" and "question marks".

Debugging tip: सूरज, when correctly encoded in utf8 (or utf8mb4) is E0A4B8 E0A582 E0A4B0 E0A49C. Other Devanagari letters will look similar. If you are getting something different, I can help you decipher it.

(And, yes, use InnoDB, not MyISAM.)

Rick James
  • 135,179
  • 13
  • 127
  • 222