Skip to content

Commit cfb72c7

Browse files
committed
fix: touni() should recognize bytearray
1 parent 556978e commit cfb72c7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bottle.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ def tob(s, enc='utf8'):
131131

132132

133133
def touni(s, enc='utf8', err='strict'):
134-
if isinstance(s, bytes):
135-
return s.decode(enc, err)
136-
return unicode("" if s is None else s)
134+
if isinstance(s, (bytes, bytearray)):
135+
return str(s, enc, err)
136+
return "" if s is None else str(s)
137137

138138

139139
def _stderr(*args):

0 commit comments

Comments
 (0)