0

I currently do have an address table in MYSQL, with its Character Set set to 'utf8' and Collation to 'utf8_unicode_ci'. There exists a column name Address and I am trying to store the city name Łódź into the Address column. I tried to key in directly into the table at SQLyog Community 64, as well as using the tool MYSQL for Excel but it keeps showing the error 'Incorrect string value'.

I have tried to set the Character Set set to 'utf8mb4' and Collation to 'utf8mb4_unicode_ci'and it still gives me the same error.

Any help on how should I set the character set and collation in order to store Łódź? This city name is just one of many examples, and moving forward I may experience other similar characters as well. What can I use for a universal character set?

Tan Stanley
  • 101
  • 2
  • 13
  • "I am trying to store the city name Łódź into the table" - *how* are you trying to do that? You haven't told us anything about what's trying to insert the data. – Jon Skeet May 05 '17 at 08:24
  • You should not just setup character set for MySQL, but also ensure that the program you are using for working with database also uses that character set. – Michael May 05 '17 at 08:29
  • Also execute `SHOW CREATE DATABASE your_db` and `SHOW CREATE TABLE table` to see what charset is used in database and tables. Here is how to change charset for DB and tables if it's wrong: https://stackoverflow.com/questions/6115612/how-to-convert-an-entire-mysql-database-characterset-and-collation-to-utf-8 – Michael May 05 '17 at 08:47
  • Hi @MichaelO., the query result is as shown CREATE DATABASE `for_cq_testing` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ – Tan Stanley May 05 '17 at 08:55
  • If you are using ODBC driver, check if it has UTF-8 option selected. – Michael May 05 '17 at 09:02
  • @MichaelO, thank you for your replies. But I am not sure why when i re-create the table, i am able to enter the values now. – Tan Stanley May 05 '17 at 09:09

1 Answers1

0

(utf8 and utf8mb4 work equally for Polish characters.)

You have not provided enough details about the flow of the characters, but the following should provide debugging for MySQL:

Trouble with utf8 characters; what I see is not what I stored

When stored correctly, the utf8 (or utf8mb4) encoding for Łódź is hex C581 C3B3 64 C5BA.

Community
  • 1
  • 1
Rick James
  • 135,179
  • 13
  • 127
  • 222