Skip to content
This repository has been archived by the owner on Mar 20, 2020. It is now read-only.

UnicodeDecodeError #24

Open
jay-pee opened this issue Jul 6, 2019 · 1 comment
Open

UnicodeDecodeError #24

jay-pee opened this issue Jul 6, 2019 · 1 comment

Comments

@jay-pee
Copy link
Contributor

jay-pee commented Jul 6, 2019

When importing the some flashcards with utf8 formatting this error occurs:

Traceback (most recent call last):
  File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 389, in main
    cards_to_apkg(card_iterator, pkg_arg)
  File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 340, in cards_to_apkg
    for card in cards:
  File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 328, in cards_from_dir
    for card in produce_cards(os.path.join(parent_dir, fn)):
  File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 301, in produce_cards
    for line in f:
  File "C:\Python36\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 3504: character maps to <undefined>

Changing line 297 in ankdown.py to

    with open(filename, "r", encoding="utf8") as f:

helps.

I thought though, that the default import in python is utf8. Should I do a pull request for this little bug?

@benwr
Copy link
Owner

benwr commented Jul 6, 2019

Weird! Yeah a PR would be great! (I'm traveling so it's a bit tricky to write code)

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

No branches or pull requests

2 participants