diff options
Diffstat (limited to 'wsgitools/internal.py')
-rw-r--r-- | wsgitools/internal.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/wsgitools/internal.py b/wsgitools/internal.py index c392b6a..c4f1da1 100644 --- a/wsgitools/internal.py +++ b/wsgitools/internal.py @@ -5,6 +5,8 @@ if bytes is str: def str2bytes(sstr): assert isinstance(sstr, str) return sstr + def textopen(filename, mode): + return open(filename, mode) else: def bytes2str(bstr): assert isinstance(bstr, bytes) @@ -12,3 +14,6 @@ else: def str2bytes(sstr): assert isinstance(sstr, str) return sstr.encode("iso-8859-1") # might fail, but spec says it doesn't + def textopen(filename, mode): + # We use the same encoding as for all wsgi strings here. + return open(filename, mode, encoding="iso-8859-1") |