1stvamp / hippybot

Hipchat.com bot written in Python with a simple plugin API
Other
95 stars 42 forks source link

plusplusbot doesn't handle unicode usernames #16

Closed alertedsnake closed 10 years ago

alertedsnake commented 10 years ago

User has a unicode character in his username. This results, and hippybot crashes:

ERROR: 'ascii' codec can't encode character u'\xae' in position 34: ordinal not in range(128)
Traceback (most recent call last):
  File "/home/michael/work/hippybot/python/lib/python2.7/site-packages/hippybot-1.2.4-py2.7.egg/hippybot/bot.py", line 291, in run
    bot.serve_forever()
  File "/home/michael/work/hippybot/python/src/jabberbot/jabberbot.py", line 823, in serve_forever
    conn.Process(1)
  File "build/bdist.linux-x86_64/egg/xmpp/dispatcher.py", line 303, in dispatch
    handler['func'](session,stanza)
  File "/home/michael/work/hippybot/python/lib/python2.7/site-packages/hippybot-1.2.4-py2.7.egg/hippybot/bot.py", line 156, in callback_message
    ret = cmd(mess)
  File "/home/michael/work/hippybot/python/lib/python2.7/site-packages/hippybot-1.2.4-py2.7.egg/hippybot/plugins/plusplusbot.py", line 32, in change_score
    room = str(mess.getFrom()).split("/")[0]
UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 34: ordinal not in range(128)
1stvamp commented 10 years ago

Laaaaame. Looks like an easy fix, I'll take a look tomorrow I'm less sleep deprived. :cake: