Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 105: invalid start byte #23

Closed
simonw opened this issue Jun 9, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Jun 9, 2022

Got this uploading this CSV: https://static.simonwillison.net/static/2022/Animal%20Rescue%20incidents%20attended%20by%20LFB%20from%20Jan%202009.csv

Relevant TODO:

def insert_docs(conn):
database = sqlite_utils.Database(conn)
# TODO: Support other encodings:
reader = csv_std.reader(codecs.iterdecode(csv.file, "utf-8"))
headers = next(reader)

@simonw simonw added the bug Something isn't working label Jun 9, 2022
@simonw
Copy link
Owner Author

simonw commented Jun 9, 2022

Related issue: if this happens an error message is shown in the logs but not to the user.

@simonw
Copy link
Owner Author

simonw commented Jun 9, 2022

I don't want to tell users to select the encoding themselves before upload, which means I need to detect it.

It looks like this is the modern alternative to chardet: https://charset-normalizer.readthedocs.io/en/latest/

@simonw simonw closed this as completed in 383014c Jun 9, 2022
simonw added a commit that referenced this issue Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant