cargo-readme icon indicating copy to clipboard operation
cargo-readme copied to clipboard

Weird encoding issue on Windows

Open kotauskas opened this issue 4 years ago • 3 comments

The — (EM DASH) symbol in my doc comment got converted to gibberish from my current code page (cp1251). This might mean that the tool reads files in cp1251 but outputs them as UTF-8.

kotauskas avatar Mar 25 '20 10:03 kotauskas

Another interesting issue is that we seem to be getting an UTF-16 BOM:

image

This is from a README.md generated using cargo-readme on Windows.

udoprog avatar Jun 11 '20 22:06 udoprog

Note that this only happens when following the README and doing the following in PowerShell:

cargo readme > README.md

Might be an artifact of .NET using UTF-16 as an internal encoding and pipes being filtered through it.

Using the -o parameter like this gives the expected UTF-8 result.

cargo readme -o README.md

Could be worth adding a note to the README.

udoprog avatar Jun 11 '20 22:06 udoprog

Yeah, I opened a PR (#50) sometime before on this topic. I actually solved this the same way, by replacing > with an -o.

kotauskas avatar Jun 12 '20 09:06 kotauskas