UnicodeEncodeError in fastlogging with Non-ASCII Characters #312
Unanswered
karelvysinka
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am experiencing an issue with the fastlogging package when logging messages that contain non-ASCII characters, specifically the character '\U0001f680' (🚀). The error occurs when the logger attempts to write data to a file. Here's the traceback for the error:
Traceback (most recent call last):
File "C:\Users\karel\AppData\Roaming\Python\Python312\site-packages\fastlogging\fastlogging.py", line 401, in _logMessage
self.__writePending()
File "C:\Users\karel\AppData\Roaming\Python\Python312\site-packages\fastlogging\fastlogging.py", line 360, in __writePending
self.F.write(data)
File "C:\Program Files\Python312\Lib\encodings\cp1250.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f680' in position 142: character maps to
This issue seems to arise due to the fastlogging library attempting to write a message containing the Unicode rocket emoji to a file, but it fails because the underlying character map (cp1250) cannot encode the emoji.
Could you please provide guidance on how to handle logging of non-ASCII characters with fastlogging, or suggest a workaround for this issue?
Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions