-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix unicode decode error in logging handlers #5258
Conversation
@Gobberwart, thanks for your PR! By analyzing the annotation information on this pull request, we identified @anakin5, @extink and @eevee-github to be potential reviewers |
You are missing |
I guess this line was removed in 1-2 days: |
In this case, the actual error was an extra comma, eg.
Fix has been applied to that as well. |
I'm actually very happy to remove the changes to the logging handlers, and just leave the fix for this specific error in place. Let me know. |
I don't know UTF8 at all.... It's up to you guys. |
@anakin5 your thoughts? |
@anakin5 is correct. Left the fix in for cached_fort event, removed the carpet-sweeping stuff. |
Is there any issue with CI build? |
For the explanation. As a convenience, unicode can be initialised with a similar syntax as strings: x= u"abc". In applications that need to handle unicode, it is generally better to have all your strings represented as unicode so that functions like len() are returning the correct result. The problem is that in python 2.x, default representation of strings is str ascii (it is unicode in python 3). Second problem is that, when the python logging module fail to convert a unicode, it falls back to utf8 conversion, which will then fail to be displayed if the encoding of your stdout is ascii. So well, there is no choice: use python 3 or make sure we use unicode to represent our strings. |
Good info to know. In this case though it was just an extra comma :) |
Short Description:
If formatted_msg is a string (eg. "Forts cached."), bot crashes with error:
Modified logging handlers to use string if encode fails.
I've fixed the error in "forts cached" event, but left this in to gracefully handle any future similar errors.