Skip to content

Changed the UTF Encoding instance to avoid inserting the BOM character #10

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

Merged
merged 2 commits into from
Jul 28, 2016

Conversation

chrismld
Copy link
Contributor

Fix to solve issue #9

@chrismld
Copy link
Contributor Author

@nblumhardt it seems that this won't be possible for now, look https://github.com/dotnet/coreclr/issues/5000

@nblumhardt
Copy link
Member

Thanks Christian!

I don't think that the linked issue is the problem here, the compiler error is:

C:\projects\serilog-sinks-file\src\Serilog.Sinks.File\Sinks\File\FileSink.cs(59,71): error CS0246: The type or namespace name 'UTF8Encoding' could not be found (are you missing a using directive or an assembly reference?)

If the constructor accepting bool isn't present, the issue suggests that new UTF8Encoding() will do as we desire - a conditional compilation directive would cover both platforms in that case.

@chrismld
Copy link
Contributor Author

@nblumhardt still not working, that constructor doesn't exist anymore

@nblumhardt
Copy link
Member

The package:

        "System.Text.Encoding.Extensions": "4.0.11"

needs to be added to the netstandard1.3 dependency group for the UTF8Encoding type to appear.

Just a thought, shall we write it as:

new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)

I.e., name the parameter so that there's absolutely no ambiguity?

The above works without any conditional compilation, so seems like the way to go 👍

@chrismld
Copy link
Contributor Author

@nblumhardt not sure what happened but yesterday I just tried the same thing and it didn't work (guess it was my workstation). Anyways, I already submitted the change here, I'm gonna do it for the RollingFile project :)

@nblumhardt
Copy link
Member

Thanks @christianhxc, great stuff :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants