Python 3 friendly encoding support