0

I started working for a client on an existing wordpress site that is encoded using 'latin1'

wp-config.php

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'latin1' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

And db is encoded utf8mb4_unicode_ci

All the Hebrew texts in db are stored like קצת עלי×, but the website is displaying them correctly.

I want to switch to utf8mb4_unicode_ci on both db and wp-config and that the correct strings in the db will transform to the actual Hebrew texts. Nothing I tried works, how can i do that?

Bonus question - I already made a lot of changes in my localhost using xammp and Duplicator, and when I tried migrating to the server, the site frontend was also in קצת עלי×. tried to change it to

define('DB_CHARSET', 'utf8mb4');

// Set the database collation.
define('DB_COLLATE', 'utf8mb4_unicode_ci');

And it displayed a different kind of gibberish שנ×â€??_Ã. Is there also a way to change it to encode in utf8mb4_unicode_ci using Duplicator and keep all the changes that i made so far?

Meital
  • 17
  • 6
  • You face a [mojibake](https://en.wikipedia.org/wiki/Mojibake) case (*example in Python for its universal intelligibility*): `'קצת עלי'.encode( 'utf-8').decode( 'cp1252', 'ignore')` returns `'קצת עלי'`. And a *double* mojibake `'קצת עלי'.encode( 'utf-8').decode( 'cp1252').encode( 'utf-8').decode( 'cp1252')` returns `'קצת עלי'` Follow [UTF-8 Everywhere](https://utf8everywhere.org/) and [UTF-8 all the way through](https://stackoverflow.com/questions/279170/)… – JosefZ Jul 26 '23 at 20:22
  • Thank you! Any idea how to solve it in Wordpress mysql? I am using phpmyadmin – Meital Jul 31 '23 at 08:58
  • Switch to [UTF-8 Everywhere](https://utf8everywhere.org/). Maybe this could help: [UTF-8 all the way through](https://stackoverflow.com/questions/279170/)? – JosefZ Jul 31 '23 at 11:23

0 Answers0