-
-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect byte-order mark. #799
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% certain that Fantomas should respect BOM, honestly. I lean towards "yes, it should respect BOM", because it seems nice to write out in the same encoding that we read in; but I could understand if Fantomas were opinionated about output format.
I think it is a good thing to respect the BOM, the case about formatting outside the IDE seems like a valid one to have this. FSharpSpec says:
See https://fsharp.org/specs/language-spec/4.1/FSharpSpec-4.1-latest.pdf#page=25 @auduchinok how does Rider handle this? Can it work with UTF16 F# files for example? |
Huh - if the F# compiler is not guaranteed to handle non-UTF8 files then that's a very strong argument that we should at least normalise to UTF-8. Whether to support other encodings as input really boils down to "how hard will it be"; if it's very easy, then it would kind of be nice to receive an arbitrary .txt file with F# code in, and be able to format it. But that does seem low priority if it's easier to assume UTF-8. |
This worked on my machine on Windows.
I'm not really an expert when it comes to these things, all suggestions to improve are welcome.