Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8315889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:13:58+00:00 2026-06-08T21:13:58+00:00

We have a MySQL table with fields using latin1_swedish_ci however there is some UTF-8

  • 0

We have a MySQL table with fields using latin1_swedish_ci however there is some UTF-8 encoded data in there.

When I change the collation from latin1_swedish_ci to utf8_general_ci it converts the ISO-8859-1 stuff fine, but the UTF-8 data gets broken, seeing things like… you’re.

Any ideas?

Edit: we are using InnoDB with MySQL 5.1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:13:59+00:00Added an answer on June 8, 2026 at 9:13 pm

    So, your “latin1” column had some data encoded in UTF-8, but not everything, and now you have some data doubly-encoded in UTF-8?

    You could do this to fix the doubly encoded values: first convert back to latin1, re-interprete the string as binary, and tell MySQL that the binary string is actually text encoded in UTF-8. In MySQL this can be written as:

    convert(binary convert(mycolumn using latin1) using utf8)
    

    Now the problem is detecting which strings are doubly encoded, so that you can update only those. This can be done by comparing the length of the original string in characters with the length of the new string in bytes; for doubly-encoded text they should be equal. This is how you end up with:

    update mytable set mycolumn = @str where char_length(mycolumn) = 
        length(@str := convert(binary convert(mycolumn using latin1) using utf8));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL table & fields that are all set to UTF-8. The
I have a MySQL table with a tree data structure. The fields are _id
I have a mysql table which has data from all flight bookings on my
I have a large MySQL table (8-9k records, I'm using phpMyAdmin) with some values
Suppose i have a mysql table name table with fields rank date id The
I have a MySQL table called Users. The rows have 4 fields and look
I have a mysql DB table of about 10.000 rows and about 20 fields.
My MySQL table is simple. I have 3 fields: an index a url a
I have a table in MYSQL, with the fields, id, size and color. An
I have a mysql table field set as time type which stores data in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.