Skip to content

Commit

Permalink
[project] Add steps to debug and fix unicode errors
Browse files Browse the repository at this point in the history
As one of the discussions in the forum has shown, the recommendation doesn't always work on some systems. So adding instructions how to verify the solution and how to manually open files in Unicode mode.
  • Loading branch information
aborg-dev authored Mar 23, 2019
1 parent 1b9fccd commit f9621c2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,16 @@ export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
```

To verify the effect, you can run the following command end check that it outputs 'utf-8'
```python
> python -c 'import locale; print(locale.getpreferredencoding())'
utf-8
```

You can find more details in this [article](https://perlgeek.de/en/article/set-up-a-clean-utf8-environment).

If this doesn't work, you can explicitly specify the encoding when opening files:
```python
with open(filename, 'r', encoding="utf-8") as file:
...
```

0 comments on commit f9621c2

Please sign in to comment.