Database characters unicode problems after migration

Hi,

I’ve recently migrated my OMP 3.1.1.3 to new server. In the last server the character code was utf8_general_ci

After migration it is utf8mb3_general_ci

Now the website shows texts wrongly:

image

My config.inc.php is setted as follows:

; Default locale
locale = en_US

; Client output/input character set
client_charset = utf-8

; Database connection character set
; Must be set to “Off” if not supported by the database server
; If enabled, must be the same character set as “client_charset”
; (although the actual name may differ slightly depending on the server)
connection_charset = Off

; Database storage character set
; Must be set to “Off” if not supported by the database server
database_charset = Off

; Enable character normalization to utf-8 (recommended)
; If disabled, strings will be passed through in their native encoding
charset_normalization = Off

I tried to change this values without success. Do you have any suggestion?

Thank you,

Enzo

@Enzo try this fix

SELECT CONCAT(
'ALTER TABLE ‘, table_name,
’ CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;’
)
FROM information_schema.tables
WHERE table_schema = ‘your_database_name’;

1 Like

Are you sure it’s okay to forcefully change the DB encoding?
I mean, why does the new server default to utf8mb4_general_ci encoding? On the same server, I installed an OJS 3.4.0.8 site with utf8mb4_general_ci encoding, and it works fine.

Thanks!

Hi @Enzo,

A typical OJS installation that is properly configured for UTF-8 will have:

; Database connection character set
connection_charset = utf8

It’s entirely possible that your old database was defaulting to Latin1 (depending on your database configuration), so the data in the old database may be double-encoded (as suggested by the “mojibake” e.g. Güvenç).

When you dump the old database to the new server, it is likely revealing the double-encoded data that was previously not visible.

Search this forum for “mojibake” and you’ll get some suggestions.

Regards,
Alec Smecher
Public Knowledge Project Team