attempt to implement support of unicode characters in a portable way.