2016-11-27 86 views
0

我想存儲在獨特的列波蘭語和德語標誌。 當我改變數據庫:波蘭語和德語重音字母在mysql

alter database osa character set utf8 collate utf8_general_ci; 

我有德國跡象問題。

sql> insert into company(uuid, name) VALUE ("1","IDE") 
[2016-11-27 10:37:35] 1 row affected in 13ms 

sql> insert into company(uuid, name) VALUE ("2","IDĘ") 
[2016-11-27 10:37:37] 1 row affected in 9ms 

sql> insert into company(uuid, name) VALUE ("3","Schuring") 
[2016-11-27 10:37:38] 1 row affected in 13ms 

sql> insert into company(uuid, name) VALUE ("4","Schüring") 
[2016-11-27 10:37:39] [23000][1062] Duplicate entry 'Schüring' for key 'UK_niu8sfil2gxywcru9ah3r4ec5' 

我必須使用哪種整理?

編輯:

也不爲utf8_unicode_ci

回答

0
alter database osa character set utf8mb4 COLLATE utf8mb4_bin; 

爲我工作。 @MaciekBryński感謝你的提示。

+0

'bin'是的,不是'mb4'。 –

+0

@RickJames準確,我知道。 –

+0

只是爲他人澄清。 –

0

作品與utf8_unicode_ci而不是替換的utf8_general_ci所有出現。 utf8_general_ci被打破,顯然是:What are the diffrences between utf8_general_ci and utf8_unicode_ci?

utf8_general_ci是一個非常簡單的 - 和Unicode的,很破 - 整理,一個給出了一般的Unicode文本不正確的結果。

+0

utf8_unicode_ci不適用于波蘭語標誌 –

+1

從技術上講,ut8_unicode_ci已損壞,由utf8_unicode_520_ci修復。有了8.0,還有一個更新的標準:utf8mb4_unicode_900_ci。 –

0

也許你應該試試utf8mb4_unicode_ci?

Utf8字符集不能存儲所有utf8字符。

https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html

+0

遺憾的是仍然沒有工作:( –

+0

sql>插入公司(名稱)VALUE(「IDE」) [2016-11-27 22:45:22] 1行受到影響13ms sql> insert into company(name)VALUE (「IDĘ」) [2016-11-27 22:45:24] [23000] [1062]關鍵字'UK_name'的重複條目'IDĘ' –

+0

所有歐洲字符都包含在兩個字符集中 –

1

COLLATION中的_ci表示「字符不敏感」。不幸的是,它也意味着「不區分變音」。因此,要得到EĘ以不同的方式處理,您需要一個_bin歸類 - utf8_binutf8mb4_bin。表情符號和中文需要

mb4加上一些不太明顯的東西。