HamishWHC / class-email

MIT License
0 stars 0 forks source link

utf-8 decoding error #1

Closed samman375 closed 1 month ago

samman375 commented 1 month ago

The script currently throws this error and fails:

Traceback (most recent call last):
  File "/Users/samthorley/.pyenv/versions/3.9.9/bin/class-email", line 8, in <module>
    sys.exit(main())
  File "/Users/samthorley/.pyenv/versions/3.9.9/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/samthorley/.pyenv/versions/3.9.9/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/samthorley/.pyenv/versions/3.9.9/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/samthorley/.pyenv/versions/3.9.9/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/samthorley/.pyenv/versions/3.9.9/lib/python3.9/site-packages/class_email/__init__.py", line 96, in main
    for i, row in enumerate(csv):
  File "/Users/samthorley/.pyenv/versions/3.9.9/lib/python3.9/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 3223: invalid start byte
samman375 commented 1 month ago

I've made a fix but currently can't push the change.

HamishWHC commented 1 month ago

Please fork the repo and make a PR from there.

HamishWHC commented 1 month ago

Made a fix myself using ASCII surrogates (https://docs.python.org/3/howto/unicode.html#files-in-an-unknown-encoding), see https://github.com/HamishWHC/class-email/commit/cec8b34acc30c92585b42c6b940ca6ee8944b40b.