Skip to content

Fix irk for Python 3 and Unicode input

Laurent Bachelier requested to merge laurentbachelier/irker:master into master

There were several issues:

  • json.dumps does not have an encoding parameter in Python 3.
  • Forcing the json.dumps encoding to ASCII prevents any non-ASCII character in the message. To avoid having non-ASCII characters in the dump, the only needed parameter is ensure_ascii=True which is the default.
  • To coerce a str to bytes in Python 3, an encoding must be provided even when it only contains ASCII characters. The solution is to use the encode() method which is available in both versions.

Merge request reports