New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logging.StreamHandler encodes log message in UTF-8 #39499
Comments
For some reason that I do not see, if not hasattr(types, "UnicodeType"): #if
no unicode support...
self.stream.write("%s\n" % msg)
else:
try:
self.stream.write("%s\n" % msg)
except UnicodeError:
self.stream.write("%s\n" %
msg.encode("UTF-8")) This behaviour is neither documented nor reasonable. self.stream.write(msg)
self.stream.write("\n") |
Logged In: YES That would be an incompatible change, of course, as you then |
Logged In: YES Notice that UTF-8 is only used if a UnicodeError is detected. |
Logged In: YES Hmmm... I can't remember what the exact problem was, but now Still, I'd like the encoding to be configurable: UTF-8 can |
Logged In: YES If you want to use some other encoding, why not use a Or, do you mean, for the exception handler? I think UTF-8 is I'll close this bug report now, I assume that's OK with you? |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: