When saving a Pandas dataset to Excel I ran into
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe6 in position 0: invalid continuation byte
Some digging showed that I can put together 3 ascii characters and the resulting string appears to start with an UTF-8 continuation byte. Obviously there're no multibyte characters in the string. What is the best way overcome this so that all my data is interpreted as ASCII characters?
Here is Python code that demonstrates how continuation byte manifests
Python 3.7.1 (default, Dec 14 2018, 13:28:58)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> string_from_3_ascii_chars = chr(50) + chr(51) + chr(48)
>>> print(string_from_3_ascii_chars)
230
>>> print(string_from_3_ascii_chars.startswith(str(0xe6)))
True
>>>