diff options
author | Ian Ward <ian@excess.org> | 2013-12-26 19:33:11 -0500 |
---|---|---|
committer | Ian Ward <ian@excess.org> | 2013-12-26 19:33:11 -0500 |
commit | 59efd264d1fd332d94d5fa4a47274951d15c5f9c (patch) | |
tree | 8bfcbda4692169a27a8a8d520cdc31742b1e8ae2 /urwid | |
parent | 7a1a225c722571d50ef9de331fb5594392d4d5c4 (diff) | |
download | urwid-59efd264d1fd332d94d5fa4a47274951d15c5f9c.tar.gz |
use codecs.encode for python2.6 compatibility
Diffstat (limited to 'urwid')
-rw-r--r-- | urwid/util.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/urwid/util.py b/urwid/util.py index ee3dce1..39a0f7e 100644 --- a/urwid/util.py +++ b/urwid/util.py @@ -23,6 +23,8 @@ from urwid import escape from urwid.compat import bytes +import codecs + str_util = escape.str_util # bring str_util functions into our namespace @@ -118,7 +120,7 @@ def apply_target_encoding( s ): if type(s) == unicode: s = s.replace(escape.SI+escape.SO, u"") # remove redundant shifts - s = s.encode(_target_encoding, errors='replace') + s = codecs.encode(s, _target_encoding, errors='replace') assert isinstance(s, bytes) SO = escape.SO.encode('ascii') |