test and fix unicode handling in __repr__