0

I'm trying to import a CSV file into the insert tab of a MySQL database model. Importing the file gives the following error:

Error during data import: UnicodeDecodeError("'ascii' codec can't decode byte 0xc4 in position 1150: ordinal not in range(128)")

It consistently happens with come CSV files but not others. I think there is an unsupported character somewhere in the data. How can I fix this?

1
  • Use not ASCII decoder, specify correct charset according to the codepage (CHARACTER SET option in LOAD DATA statement).
    – Akina
    Jun 23 at 5:43

1 Answer 1

0

Its telling you character hex c4 which is Ä. Which means that your table is currently set up for ascii which deals with characters x00 to x7f. You can

  1. Either delete it in the csv file,
  2. Replace it with something else in the csv file
  3. Change your table schema from ascii to utf8 or unicode

Further information for charactersets and collation is here dev.mysql

3
  • 3. Change your table schema from ascii to utf8 or unicode This makes no sense. The problem occures at data loading step, before loaded data converting to needed charset on inserting into the table step. The statement cannot apply "before" charset for loaded data on built-in CONVERT() function execution. 1. .. 2. .. - I doubt that damaging the source data can be considered to be safe solution.
    – Akina
    Jun 23 at 5:46
  • Searching the original google sheet for Ä doesn't yield any results. Jun 23 at 19:29
  • Thanks, I ended up using the power tools add-on to remove the special character from the google sheet before I made it a CSV Jun 24 at 0:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.