fix unicode encoding/decoding errors