diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-08 14:56:17 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-08 14:56:17 +0200 |
commit | 203fe3058cf999f763051740027582dd357f2028 (patch) | |
tree | 047a65399efdf15931df74b8a6f7a82c9b4fc9e6 | |
parent | 01b725c25282a785c25e6113f03692cdff7ca26a (diff) | |
download | pygobject-203fe3058cf999f763051740027582dd357f2028.tar.gz |
Always use utf-8 and not the default encoding
In the recent cleanup I missed that Python 2 doesn't default to
utf-8 there.
-rw-r--r-- | examples/demo/demos/rotatedtext.py | 4 | ||||
-rw-r--r-- | gi/_option.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/examples/demo/demos/rotatedtext.py b/examples/demo/demos/rotatedtext.py index 429bbdfa..806c1493 100644 --- a/examples/demo/demos/rotatedtext.py +++ b/examples/demo/demos/rotatedtext.py @@ -34,8 +34,8 @@ import math UTF8_TEXT = u"I ♥ GTK+" HEART = u"♥" -BYTES_TEXT = UTF8_TEXT.encode() -BYTES_HEART = HEART.encode() +BYTES_TEXT = UTF8_TEXT.encode("utf-8") +BYTES_HEART = HEART.encode("utf-8") class RotatedTextApp: diff --git a/gi/_option.py b/gi/_option.py index f1c8169c..3791137b 100644 --- a/gi/_option.py +++ b/gi/_option.py @@ -133,7 +133,7 @@ class Option(optparse.Option): for (long_name, short_name) in zip(self._long_opts, self._short_opts): short_bytes = short_name[1] if not isinstance(short_bytes, bytes): - short_bytes = short_bytes.encode() + short_bytes = short_bytes.encode("utf-8") yield (long_name[2:], short_bytes, flags, self.help, self.metavar) for long_name in self._long_opts[len(self._short_opts):]: |