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?

asked Jun 23, 2023 at 3:30
1
  • Use not ASCII decoder, specify correct charset according to the codepage (CHARACTER SET option in LOAD DATA statement). Commented Jun 23, 2023 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

answered Jun 23, 2023 at 4:06
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. Commented Jun 23, 2023 at 5:46
  • Searching the original google sheet for Ä doesn't yield any results. Commented Jun 23, 2023 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 Commented Jun 24, 2023 at 0:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.