emi
emi

Reputation: 2950

Character encoding not supporting Polish characters in MySQL/PHPmyAdmin

I have an MySQL database that has some Polish characters in it showing as ? instead of letters like "ł, ą, ć, etc". I have changed the collation to utf8_unicode_ci and utf8_polish_ci.

I have also tried this on the table

ALTER TABLE tbl MODIFY COLUMN txt TEXT CHARACTER SET utf8

and still nothing.

My table still looks like this:

enter image description here

Maybe someone knows why?

Upvotes: 0

Views: 2834

Answers (2)

Deep Hakani
Deep Hakani

Reputation: 198

there 2 possibility

1) your column not alter correctly. use below query.

ALTER TABLE miasta CHANGE nazwa_miasta nazwa_miasta TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL

2) check string at time of insert. if during insert the string is not in utf8 it create problem. so first convert it in utf8 ( http://php.net/manual/en/function.mb-convert-encoding.php ) then insert.

Upvotes: 0

Isaac Bennetch
Isaac Bennetch

Reputation: 12462

Probably this is a factor of how you're inserting data. Answers to the questions @bski wrote would be helpful here. What application is inserting the data? What charset is being used for that connection?

Most likely you haven't set the charset in your application, or have set it incorrectly. Issue a command like SET NAMES 'UTF8'; when initializing the connection and see if that improves the data stored.

phpMyAdmin itself works fine with UTF data and pretty much displays exactly what is stored in the MySQL database, so in cases like this when the data doesn't appear correct it means your application isn't storing it correctly. If it appears correct in your application, it basically means you're both inserting and retrieving it incorrectly.

Related links:

Upvotes: 1

Related Questions