fix multi-byte unicode encoding/decoding issues