Improve charset encoding/decoding