Closed Vbif closed 8 years ago
Does this add a BOM (it's hard to see in the diff)? Is that the only way to make VisualStudio use UTF-8 for these files? Also, Cargo.toml
should be handled the same, because it may also contain UTF-8 (see https://github.com/rust-lang/cargo/issues/2031).
Yes this commit add the BOM. Cargo files already with BOM.
Thanks!
Sorry to chime in late, but I'm pretty sure nobody wants BOMs. A while back I did an informal survey amongst open-source developers I know and the response was 100% hate.
I'd rather have the VisualRust extension automatically switch the encoding to UTF-8 for all .rs files. As stated in https://doc.rust-lang.org/reference.html#input-format, UTF-8 is the only allowed encoding.
@briansmith this need further investigation @Boddlnagg I think https://github.com/PistonDevelopers/VisualRust/issues/256 need to be reopened
When I did the BOM handling in toml-rs (for Cargo.toml) it was out of pure necessity, simply because Visual Studio by default adds the BOMs whenever saving an UTF-8 file. I think everyone hates BOMs but if VS will always write BOMs anyway them it's better to consistently have BOMs, than to have them show up at the next save. Starting from a UTF-8 text file without BOM you get an (invisible) diff after saving. So since the rust template files are intended purely for VS, and VS is going to add a BOM later - shouldn't they ideally be UTF-8 files with BOM to begin with?
If VS can be persuaded to write an UTF-8 file without BOM then the story is different of course.
This looks posible, because there is already such solution https://vlasovstudio.com/fix-file-encoding/
I would be happy with any change that makes this possible without a BOM, but currently I'm following the reasoning of @andersforsgren. I opened #259 to track this.
Fix https://github.com/PistonDevelopers/VisualRust/issues/256