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

Datasette with Glitch - is it possible to use CSV with ISO-8859-1 encoding? #1382

Closed
reichaves opened this issue Jun 19, 2021 · 1 comment
Closed

Comments

@reichaves
Copy link

reichaves commented Jun 19, 2021

Hi
Please, I used Remix on Glitch to create a project on Glitch and uploaded a CSV
But it's a CSV with ISO-8859-1 encoding (https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Is it possible for me to change the encoding to correctly visualize the data?
Example: https://emphasized-carpal-pillow.glitch.me/data/Emendas
Best

@simonw
Copy link
Owner

simonw commented Jun 20, 2021

Yes you can - thanks for pointing this out, I've added a comment to the install.sh script in the datasette-csvs Glitch project:

pip3 install -U --no-cache-dir -r requirements.txt --user && \
  mkdir -p .data && \
  rm .data/data.db || true && \
  for f in *.csv
    do
      # Add --encoding=latin-1 to the following if your CSVs use a different encoding:
      sqlite-utils insert .data/data.db ${f%.*} $f --csv
    done

So if you edit that file in your own project and change the line to this:

  sqlite-utils insert .data/data.db ${f%.*} $f --csv --encoding=iso-8859-1

It should fix this for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants