debug encode utf8 functions