0

I have problems with encoding saved incorrectly in the database, so my strings that I was saving to MySQL db are broken now.

Example:

1) In the database it is saved like: H²Flow™

But it should be: H²FLOW™

2)

In the database it is saved like:

Ægir Homme

But it should be: ÆGIR Homme

Does anyone have some suggestions on how can I fix the existing records? I have over 10000 records that have these problems, so I would like to avoid manual editing.

The encoding in my database table is utf8 and collation is utf8_general_ci.

I am using PHP, and any suggestion is appreciated.

Bob
  • 8,392
  • 12
  • 55
  • 96
  • 1
    Does this answer your question? [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – ADyson Aug 28 '20 at 08:50
  • @ADyson No, it actually doesn't. I need to find a way how to convert existing broken strings into the correct strings. – Bob Aug 28 '20 at 08:53
  • Does this answer your question? [Fixing broken UTF-8 encoding](https://stackoverflow.com/questions/1344692/fixing-broken-utf-8-encoding) – Anton Aug 28 '20 at 09:08

1 Answers1

0

Set your database character set to utf8mb4 encoding.

MySQL's explanation for charset utf8mb4

Gazmend Sahiti
  • 443
  • 3
  • 13
  • I have updated the table encoding, but didn't fix the problem. `ALTER TABLE my_table_name CHARACTER SET utf8mb4, COLLATE utf8mb4_general_ci;` The records are still broken in the DB. – Bob Aug 28 '20 at 12:46