Continuing my question from here _ link
for example, I get data from my file my_text.txt
into a variable u
:
my_text.txt
my text Зд
let u = fs::read("/.../my_text.txt").expect("error on handling file");
println!("{:?}", u); // [109, 121, 32, 116, 101, 120, 116, 32, 199, 228]
[109, 121, 32, 116, 101, 120, 116, 32, 199, 228]
So I see that I can get the data from the link above
fn main() {
let u01: Vec<u8> = vec![109, 121, 32, 116, 101, 120, 116];
println!("u01 = {:?}", std::str::from_utf8 (&u01[..]).unwrap()); // my text
}
But can’t get it in Cyrillic
[109, 121, 32, 116, 101, 120, 116, 32, 199, 228]
fn main() {
let u02: Vec<u8> = vec![199, 228];
println!("u02 = {:?}", std::str::from_utf8 (&u02[..]).unwrap()); // ? not work
}
I am getting u01 and u02 from u in loop.
How to get back from vec![199, 228] to "Зд"?