Skip to content

Commit

Permalink
fix utf-8 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
gflohr committed Dec 13, 2023
1 parent d3ae152 commit ddb360f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Added

* Top-level `Makefile`.
* top-level `Makefile`

### Fixed

* correct location of meta.json with configuration

### Changed

* Modified project structure.
* modified project structure
* PGN files must now be in UTF-8

## [0.1.0] - 2023-11-21

### Added

* Importer for PGN files.
* Configuration to keep user preferences.
* importer for PGN files
* configuration to keep user preferences
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ position with white to move. If you later edit the study, you can import
an updated version again, that gets merged into the existing deck. Your
progress will be preserved to the extent possible.

*Important!* The PGN file must be in UTF-8 encoding!

## Copyright

This is free software. Copyright © 2023, Guido Flohr <[email protected]>,
Expand Down
6 changes: 1 addition & 5 deletions src/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ def run(self) -> [int, int, int]:
return patch(ps, self.collection, self.deck)

def _read_study(self, filename: str) -> None:
# The encoding "cp1252" is pretty much equivalent to binary. It also
# covers the range from 128 to 159 avoiding encoding errors. And
# we just pass through characters to Anki and therefore don't care
# about character semantics.
with open(filename, encoding='cp1252') as study_pgn:
with open(filename, encoding='utf-8') as study_pgn:

def get_visitor() -> chess.pgn.BaseVisitor:
return self.visitor
Expand Down

0 comments on commit ddb360f

Please sign in to comment.