Final encoding fix. It now work on IRC and unit tests pass, both with Python 2 & 3.