If a C# file is saved as UTF8 with BOM and starts with a preprocessor macro, the indentation is incorrect.
Source (correct, saved as UTF8 with BOM):
#if FLAG
using System.IO;
namespace X
{
public static class Y
{
[Attribute(0)]
public static void Method(string param)
{
}
}
}
#endif // FLAG
Current trunk (incorrect):
#if FLAG
using System.IO;
namespace X
{
public static class Y
{
[Attribute(0)]
public static void Method(string param)
{
}
}
}
#endif // FLAG
This issue only happens if a file starts with a preprocessor macro and is saved as UTF8 with BOM.
I'm looking at a way to fix this, but encoding handling looks messy. It seems like not all paths even handle encoding (processing from file names does to some degree, but processing from Cin does not at all). It looks like that part needs a refactoring.