Handle encodings properly