Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 907 Bytes

SA1412.md

File metadata and controls

33 lines (25 loc) · 907 Bytes

SA1412

TypeName SA1412StoreFilesAsUtf8
CheckId SA1412
Category Maintainability Rules

📝 This rule is new for StyleCop Analyzers, and was not present in StyleCop Classic.

Cause

The encoding of the file is not UTF-8 with byte order mark.

Rule description

Storing files in this encoding ensures that the files are always treated the same way by the compiler, even when compiled on systems with varying default system encodings. In addition, this encoding is the most widely supported encoding for features like visual diffs on GitHub and other tooling. This encoding is also the default encoding used when creating new C# source files within Visual Studio.

How to fix violations

To fix a violation of this rule, convert the files encoding to UTF-8 with byte order mark