Don't UnicodeDecodeError on non-ascii not-found hooks. Resolves #207.

This commit is contained in:
Anthony Sottile 2015-05-21 07:49:22 -07:00
parent 20c546a7da
commit 7905594215
5 changed files with 35 additions and 12 deletions

View file

@ -20,3 +20,11 @@ else: # pragma: no cover (PY3 only)
return s
else:
return s.decode('UTF-8')
def to_text(s):
return s if isinstance(s, text) else s.decode('UTF-8')
def to_bytes(s):
return s if isinstance(s, bytes) else s.encode('UTF-8')