Skip to content

pyzet add - UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed; invalid continuation byte #3

@tpwo

Description

@tpwo

During migration from hackmd, one of my notes caused the following error:

> pz add
INFO:root:20211028212144 was created
Traceback (most recent call last):
  File "C:\Users\trivvz\repos\github.com\trivvz\pyzet\venv\Scripts\pz-script.py", line 33, in <module>
    sys.exit(load_entry_point('pyzet', 'console_scripts', 'pz')())
  File "c:\users\trivvz\repos\github.com\trivvz\pyzet\src\pyzet\main.py", line 112, in main
    return add_zettel(config)
  File "c:\users\trivvz\repos\github.com\trivvz\pyzet\src\pyzet\main.py", line 189, in add_zettel
    zettel = get_zettel(zettel_path.parent)
  File "c:\users\trivvz\repos\github.com\trivvz\pyzet\src\pyzet\zettel.py", line 39, in get_zettel
    contents = file.readlines()
  File "C:\Program Files\Python39\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 7528: invalid continuation byte

The link to the problematic note:

https://hackmd.io/d4GbNi4sR7yf7YQ-HZoHng

I found the root cause: 😉

So it seems that UTF-8 doesn't like emojis. Probably there's a simple workaround, so this can be fixed, I hope.

  • make pyzet work with emojis (done in d9b3980)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions