3

Utf8 collated with my native language collation "utf_slovak_ci" does not allow me to insert words with special characters like "ľ,š,š,č,ť,ž,ý,á,í,é,ô,ň,ä" which are specific for my language.

The whole situation is pictured here:

Where could be the problem? Should I switch the charsets? If yes, then which one to use? Or is it any other problem I do not see?

I read quite a lot of Q&A on this topic but none seem to answer my question. The only thing I became aware of is the possibility, that there might be an issue with "cmd.exe" on this. But switching to "cp850" or "cp1250" did not help either.

Dexter_EX
  • 53
  • 1
  • 6
  • Could this be possibly of a help? http://stackoverflow.com/questions/11936950/inserting-utf-8-encoded-string-into-utf-8-encoded-mysql-table-fails-with-incorr – Tomas M Jan 29 '15 at 17:44
  • @TomasMatejicek - Thanks for the hint - but I have been through that question already and I did not find it useful. THe problem is that SET NAMES or ALTER TABLE do not solve the problem in my case (tried out already). – Dexter_EX Jan 29 '15 at 17:52
  • 1
    See: http://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how/388500#388500 – Karol S Jan 29 '15 at 19:36
  • @KarolS - Thank you! Your suggestion helped me to solve the problem. The magic is the following: set chcp1250 in cmd SET NAMES cp1250 in MySQL – Dexter_EX Jan 29 '15 at 21:17

2 Answers2

0

I think the problem is the charset of your written sql...

  1. Write your SQL in a file. But think about it, to save the file as UTF-8 encoded.

  2. After that import your sql from the file by using the following command

mysql -u [USERNAME] -p [DATABASENAME] < /[DIRECTORY]/SQLFILE.sql

Dilberted
  • 1,172
  • 10
  • 23
M. Röthenmund
  • 431
  • 4
  • 4
0

If nothing works in mysql shell, try to change some settings in mysqld.cnf

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4

Answer finally found for me in MySQL utf8mb4, Errors when saving Emojis

Emanuel
  • 2,603
  • 22
  • 24