If the string contains truly Spanish accents in UTF8, I could use unidecode()
let x = unidecode("ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ");
println!("reading file: {}", x);
// output = SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy
However, I am working mainframe output file in EBCDIC format, if I view it in redhat terminal, I see "Mu�oz". If I ftp the file to OSX and view it in TextEdit, I see "MuÒoz". There are some encoding in the TextEdit when viewing ....
The utf8 Spanish accents should be C392 in Hex, but I got F1 from mainframe file. How can I convert � to Ò and then O, and for all other Spanish accents?
+++
utf8 Spanish accents = Ò = C392 (Hex) = ﺃφ
EBCDIC Spanish accents = � = F1 (Hex) = ﹼ
If I use unidecode(), it changes "Mu�oz" to "Muoz". I want to convert "Mu�oz" to "MuoOz".
=======
updated on 2023.05.03
========
I tried both ISO_8859_10 encoding ...it converted "Mu�oz" to "Muïŋ―oz". Now, I am questioning whether it is EBCDIC encoded file that I am getting ...
let file_in = File::open("infile").unwrap();
let mut file_out = File::create("outfile").unwrap();
let mut decoded_stream = DecodeReaderBytesBuilder::new()
.encoding(Some(ISO_8859_10))
.build(file_in);
std::io::copy(&mut decoded_stream, &mut file_out).unwrap();