# Python error - UnicodeDecodeError ## The error ```shell UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 1095: character maps to <undefined> ``` ## The cause Three people reported this issue when trying to run [[downloadfirebase.py]] and [this Python script](https://gist.github.com/Joilence/82e1433870c538db12086e06ac7975f7). All three users were using Windows. This error occurs because of the difference in encoding that Windows uses compared to what Mac and Linux use. ## The solution ### Try using the cp850 encoding If you're sure that the file in question uses the cp850 encoding, this may be the best option. However, it can be tricky to determine which encoding is being used. ```python with open(log_file, 'r',encoding='cp850') as log_file_fh: ``` [^stackoverflow] ### Try ignoring errors Sometimes it's easier to just skip characters it can't encode and ignore them. ```python with open(log_file, 'r',errors='ignore') as log_file_fh: ``` [^stackoverflow] [^stackoverflow]: https://stackoverflow.com/questions/42019117/unicodedecodeerror-charmap-codec-cant-decode-byte-0x8f-in-position-xxx-char