Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

Making log functions unicode safe for unknown input. #12

Closed
wants to merge 3 commits into from

Conversation

radiosilence
Copy link

Issue #11

@radiosilence
Copy link
Author

Ok, this still doesn't quite seem to fix it.

@radiosilence
Copy link
Author

Right, second commit fixed the issue.

@radiosilence
Copy link
Author

Basically, on the wire, it was picking up UTF-8 encoded bytes. Then because it was trying to format it to a string, it was trying to decode said bytes with ASCII before formatting them. And thus failed. So, you need to decode the source bytes into a unicode object using .decode('utf-8'), and make the destination string a unicode object.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 152edce on radiosilence:master into f3c453a on moccu:master.

@radiosilence
Copy link
Author

Still failing on Python 3. Hmm. It seems like the "msg" is being a bytes (str) on Python 2.7, and a unicode (str) in Python 3.

Any ideas?

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling c313373 on radiosilence:master into f3c453a on moccu:master.

@radiosilence
Copy link
Author

This is kind of a messy solution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants