Refactor decoding format, escape unconvertable #325
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've had underlying concern for a while now that universally using utf-8 isn't correct because it doesn't respect locale and this serves as fairly strong confirmation. From a little bit of digging, checking seems as simple as calling
locale.getencoding()
, but the documentation claims that this is ANSI for windows (meaning changing it would affect the majority of users). As a result, I've refactored out all the string decoding to use a common variable and set it to display an escaped version of any unconvertable characters, but am leaving the format as utf-8 until I have further information.See #324