parasew/instiki

MySQL UTF8 not working after DB restore

casper opened this issue · 3 comments

I restored my Instiki from a MySQL dump file, and all UTF8 characters now show up as if they had been interpreted as latin1 (I think). Example:

tärkeää uusintakäsittelyn välillä

Should be:
tärkeää uusintakäsittelyn välillä

If I look at the DB in the MySQL client everything looks correct. I also browse the DB with HeidiSQL and there as well all looks fine.

But when interpreted by Instiki it all comes out as garbled encoding on the webpage.
Any idea where the problem could be?

Running 0.30.1 on Ubuntu 18.04 with MySQL 5.7.23.
Using the mysql2 gem with "encoding: utf8" in database.yml.

Update:
Editing the corrupted page in the wiki and then resaving it fixes the corruption.
This seems to have solved the issue.

You definitely want to use encoding: utf8mb4, rather than encoding: utf8 (make sure the MySQL tables are also utf8mb4-encoded). Choosing encoding: utf8 will lead to data loss if your content contains any utf-8 characters outside the Basic Multilingual Plane.

See here and here.

Ok. Those are great references. Will have to convert my DB it seems. Thank you.