diff --git a/src/utils/str.py b/src/utils/str.py index a227ff7dc..f3003b43a 100644 --- a/src/utils/str.py +++ b/src/utils/str.py @@ -448,6 +448,13 @@ def format(s, *args, **kwargs): # to add the character to the _formatRe regexp or it will be ignored # (and hard to debug if you don't know the trick). # Of course, you should also document it in the docstring above. + if sys.version_info.major < 3: + def pred(s): + if isinstance(s, unicode): + return s.encode('utf8') + else: + return s + args = map(pred, args) args = list(args) args.reverse() # For more efficient popping. def sub(match):