refactor py2/3 unicode solution