Encoding error with polish charset during transfer of database / server seting up

后端 未结 2 1177
谎友^
谎友^ 2021-01-27 16:43

I am trying to transfer one of my databases from one host (home.pl) to another (my newly set server). The script that I am trying to transfer is wordpress. Unluckily irrespectiv

相关标签:
2条回答
  • 2021-01-27 17:12

    At the end I have founded out that the problem was related to the fact that the data was written to SQL incorrectly in my original server.

    I ended up with transferring DB using:

    mysqldump --default-character-set=utf8 [ORYGINAL_DB] | mysql [TARGET_DB] --default-character-set=utf8
    

    and the executing:

    UPDATE [table name] SET [field] = CONVERT(BINARY CONVERT([field] USING latin2) USING utf8)
    

    as it was advices here:

    strange character encoding of stored data , old script is showing them fine new one doesn't

    Hope that the above solution will be helpful for others too.

    0 讨论(0)
  • 2021-01-27 17:14
    SET NAMES utf8;
    

    (The default is latin11, which leads to Ä™.)

    Note: init_connect is not executed for root (or any SUPER) user. So this failed you:

    init_connect='SET NAMES utf8'
    
    0 讨论(0)
提交回复
热议问题