update: Better handling of encoding

* Better handling of encoding when dealing with unicode.

Signed-off-by: mr.Shu <mr@shu.io>