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

UnicodeDecodeError  #24

@jay-pee

Description

@jay-pee

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions