add util methods for utf8 encoding and tests