@@ -516,8 +516,9 @@ def force_utf8_rec(input_obj, highlight=''):
516
516
if isinstance (input_obj , dict ):
517
517
return {force_utf8_rec (i , highlight ): force_utf8_rec (j , highlight ) for (i , j ) in
518
518
input_obj .items ()}
519
- elif isinstance (input_obj , list ):
520
- return [force_utf8_rec (i , highlight ) for i in input_obj ]
519
+ elif isinstance (input_obj , (list , tuple )):
520
+ thetype = type (input_obj )
521
+ return thetype (force_utf8_rec (i , highlight ) for i in input_obj )
521
522
elif is_unicode (input_obj ):
522
523
return force_utf8 (input_obj , highlight )
523
524
else :
@@ -544,8 +545,9 @@ def force_unicode_rec(input_obj, highlight=''):
544
545
if isinstance (input_obj , dict ):
545
546
return {force_unicode_rec (i , highlight ): force_unicode_rec (j , highlight ) for (i , j ) in
546
547
input_obj .items ()}
547
- elif isinstance (input_obj , list ):
548
- return [force_unicode_rec (i , highlight ) for i in input_obj ]
548
+ elif isinstance (input_obj , (list , tuple )):
549
+ thetype = type (input_obj )
550
+ return thetype (force_utf8_rec (i , highlight ) for i in input_obj )
549
551
elif not is_unicode (input_obj ):
550
552
return force_unicode (input_obj , highlight )
551
553
else :
0 commit comments