I currently have a simple IRC bot written in python.
Since I ported it to python 3.0, which distinguishes between Unicode bytes and strings, I am having encoding issues. In particular, if others do not send UTF-8.
Now I can just tell everyone to send UTF-8 (what they should do independently), but even the best solution would try to force python to use some other encoding or one by default.
So far, the code is as follows:
data = str(irc.recv(4096),"UTF-8", "replace")
This, at least, is not an exception. However, I want to pass it by: I want my bot to use a different encoding by default or somehow try to detect "nasty characters".
Also, I need to find out what this cryptic encoding that mIRC actually uses is because the other clients are working fine and sending UTF-8 as they should.
How do i do this?
source
share