Fix unicode regressions
Fix unicode regressions

Commit 74877d2 added improved support for python3 but introduced
some regressions around unicode handling.

Inspired-By: James E. Blair <76349f49a6eee99156d916b8bdf84c707ac3ad66@linux.vnet.ibm.com>
Change-Id: I424a921d80959777ff72df499c5931a21dc0dccb

openstack/gertty,stackforge/gertty