improve utf8 encode/decode.

Signed-off-by: Jack <jack.wgm@gmail.com>