fix bug #37

referer to http://code.activestate.com/recipes/577614-safe-unicode-representation/