Skip to content

Commit cefe133

Browse files
committed
fix: touni() should recognize bytearray
1 parent 821865d commit cefe133

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
@@ -127,9 +127,9 @@ def tob(s, enc='utf8'):
127127

128128

129129
def touni(s, enc='utf8', err='strict'):
130-
if isinstance(s, bytes):
131-
return s.decode(enc, err)
132-
return unicode("" if s is None else s)
130+
if isinstance(s, (bytes, bytearray)):
131+
return str(s, enc, err)
132+
return "" if s is None else str(s)
133133

134134

135135
def _stderr(*args):

0 commit comments

Comments
 (0)