mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
Fix unicode handling issue of utils.str.format on Python 2.
This commit is contained in:
parent
70ad232887
commit
8010cd5ae2
@ -448,6 +448,13 @@ def format(s, *args, **kwargs):
|
|||||||
# to add the character to the _formatRe regexp or it will be ignored
|
# to add the character to the _formatRe regexp or it will be ignored
|
||||||
# (and hard to debug if you don't know the trick).
|
# (and hard to debug if you don't know the trick).
|
||||||
# Of course, you should also document it in the docstring above.
|
# 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 = list(args)
|
||||||
args.reverse() # For more efficient popping.
|
args.reverse() # For more efficient popping.
|
||||||
def sub(match):
|
def sub(match):
|
||||||
|
Loading…
Reference in New Issue
Block a user