What are the options to convert ISO-8859-1 / Latin-1 to a String (UTF-8)?

Strings in Rust are unicode (UTF-8), and unicode codepoints are a superset of iso-8859-1 characters. This specific conversion is actually trivial.

fn latin1_to_string(s: &[u8]) -> String {
    s.iter().map(|&c| c as char).collect()
}

We interpret each byte as a unicode codepoint and then build a String from these codepoints.


Standard library does not have any API to deal with encodings. Encodings, like date and time, are difficult to do right and need a lot of work, so they are not present in the std.

The crate to deal with encodings as of now is rust-encoding. You will almost certainly find everything you need there.