mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Fix encoding issues with Alias containing non-ascii characters.
This commit is contained in:
parent
b360871378
commit
cefd91d4f1
@ -68,6 +68,8 @@ class AliasTestCase(ChannelPluginTestCase):
|
|||||||
def testAliasHelp(self):
|
def testAliasHelp(self):
|
||||||
self.assertNotError('alias add slashdot foo')
|
self.assertNotError('alias add slashdot foo')
|
||||||
self.assertRegexp('help slashdot', "Alias for .*foo")
|
self.assertRegexp('help slashdot', "Alias for .*foo")
|
||||||
|
self.assertNotError('alias add nonascii echo éé')
|
||||||
|
self.assertRegexp('help nonascii', "Alias for .*echo éé")
|
||||||
|
|
||||||
def testRemove(self):
|
def testRemove(self):
|
||||||
self.assertNotError('alias add foo echo bar')
|
self.assertNotError('alias add foo echo bar')
|
||||||
|
@ -444,10 +444,12 @@ def format(s, *args, **kwargs):
|
|||||||
char = match.group(1)
|
char = match.group(1)
|
||||||
if char == 's':
|
if char == 's':
|
||||||
token = args.pop()
|
token = args.pop()
|
||||||
if isinstance(token, unicode) or isinstance(token, str):
|
if isinstance(token, str):
|
||||||
return token
|
return token
|
||||||
|
elif sys.version_info[0] < 3 and isinstance(token, unicode):
|
||||||
|
return token.encode('utf8')
|
||||||
else:
|
else:
|
||||||
return unicode(token)
|
return str(token)
|
||||||
elif char == 'i':
|
elif char == 'i':
|
||||||
# XXX Improve me!
|
# XXX Improve me!
|
||||||
return str(args.pop())
|
return str(args.pop())
|
||||||
|
Loading…
Reference in New Issue
Block a user