开发者

MySQL, polish characters and duplicate insert statement

开发者 https://www.devze.com 2023-01-11 23:05 出处:网络
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:

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开发者_如何学Python help will be appreciated :)


This should do the trick:

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

The letter N is for Unicode insert.

0

精彩评论

暂无评论...
验证码 换一张
取 消