starting refacting of utf8 decode/encode