store polish characters mysql store polish characters mysql database database

store polish characters mysql


Try changing the collation to:

utf8_unicode_ci 

or

utf8_polish_ci 

You can refer to: http://mysql.rjweb.org/doc.php/charcoll

Also you can TRY altering the specific column with:

ALTER TABLE tbl MODIFY COLUMN txt TEXT CHARACTER SET utf8


I've searched a lot and finally, I got a solution with this:

ALTER TABLE tableName MODIFY COLUMN columnName VARCHAR(64) CHARACTER SET `binary`;

You can change VARCHAR(64) to match your needs. I hope this helps someone. Note that I did not only required to store Polish characters but French and Spanish ones as well. So the solutions above might work for just polish chars.


You can also change column from vchar to nvchar. Then when inserting values to DB remember to ad N before as follows: N'ŁÓDŹ' (in persistence frameworks u should have some kind of NString representation)

from documentation:

Nvarchar stores UNICODE data. If you have requirements to store UNICODE or multilingual data, nvarchar is the choice. Varchar stores ASCII data and should be your data type of choice for normal use. Regarding memory usage, nvarchar uses 2 bytes per character, whereas varchar uses 1