Fix string encoding on Python 3.x