Cyrillic problems in Rust

Question:

When trying to print the notorious "Hello world" via println! the compiler gives an error "stream did not contain valid UTF-8" and refuses to compile this stuff. The project is empty, created using cargo new, if you replace the Cyrillic alphabet with the Latin alphabet, it displays correctly. I had a suspicion that he, in principle, is not friendly with the Russian language, but the very first example from the book "The Rust Programming Language" is this very "hello world", which is calmly compiled there with the ► button on the page with the book.

The Rust version is 1.44.0 The project is clean and just created. I did not find a solution to the problem on the Internet. The rest of the compiler works fine, pulls containers with crates.io, and does not conflict with anything else. Edited through Visual Studio and Notepad ++, the effect is the same

Answer:

Thanks to comrade andreymal! You just had to change the encoding to UTF-8 in Notepad ++. Hopefully the existence of this question here helps someone not very sane like me.

Scroll to Top