MySQL, polish characters and duplicate insert statement

早过忘川 提交于 2019-12-25 01:51:13

问题


I've got a problem with inserting two rows to table. The database is in UTF8. The problem seems to be connected to the collation. This statement works:

insert into test(code,text) values('xx','aaa');

However when i try to add other row to the table:

insert into test(code,text) values('xx','aąą');

it fails with duplicate entry error. It looks like a and ą (special polish character) are threated the same. The weird thing is that when i set all collations to utf8_unicode_ci it still does not work :/ Any help will be appreciated :)


回答1:


This should do the trick:

insert into test(code,text) values('xx',N'aąą');

The letter N is for Unicode insert.



来源:https://stackoverflow.com/questions/3516460/mysql-polish-characters-and-duplicate-insert-statement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!