comprehensive-rust
comprehensive-rust copied to clipboard
Specify Unicode encoding
Page: https://google.github.io/comprehensive-rust/hello-world.html
It states Rust strings can contain Unicode characters. This is not super helpful. We need to know what encoding is supported by the string literal. Most C++ compilers will assume UTF-8 as the encoding by default. It will be helpful if this page can state the encoding.
This is not super helpful. We need to know what encoding is supported by the string literal. Most C++ compilers will assume UTF-8 as the encoding by default. It will be helpful if this page can state the encoding.
Yeah, good point! This is something I mention during class: .rs files must be valid UTF-8 — it's a compilation error if they're not. The compiler will say something like
error: couldn't read src/main.rs: stream did not contain valid UTF-8
The page doesn't point this out since it's just a slide. I'm considering adding speaker notes to be able to elaborate on these things.
Hi @mgeisler, it will be tremendously helpful if that line simply said:
Rust strings contain any UTF-8 encoded Unicode characters, such as emoji.
Thanks @bibhas2, I'll update the page like you suggest in #81.