1

please see this test table which illustrates the issue:

create table `NvarCharTest`
(
    `Name` nvarchar(100),
    PRIMARY KEY (`Name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert NvarCharTest values('forum');
insert NvarCharTest values('fórum');  -- Error Code: 1062. Duplicate entry 'fórum' for key 'PRIMARY'

now with my limited understanding of charsets and so on I'd say that 'forum' should be different to 'fórum' to this index but it appears to be considering them the same.

Can someone please tell me what's going on here and (even better) how to make MySQL think these two words are in fact different?

Many thanks! This is with MySQL version 5.5.27.

sming
  • 801
  • 2
  • 12
  • 25
  • What is the table collation of the NvarCharTest ? Run this command and check it `show table status from your_database_name` – Abhik Chakraborty Sep 22 '14 at 11:12
  • Hi @AbhikChakraborty, it is utf8_general_ci which according to http://stackoverflow.com/questions/1036454/what-are-the-diffrences-between-utf8-general-ci-and-utf8-unicode-ci is potentially problematic. – sming Sep 22 '14 at 15:44
  • Interestingly (or not) I converted the table using "alter table NvarCharTest convert to character set utf8 collate utf8_unicode_ci;" and still get the "Duplicate entry..." error. – sming Sep 22 '14 at 16:00

0 Answers0