Skip to content
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

TextSerializer is not culture invariant #170

Closed
Helco opened this issue Sep 28, 2022 · 1 comment
Closed

TextSerializer is not culture invariant #170

Helco opened this issue Sep 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Helco
Copy link
Contributor

Helco commented Sep 28, 2022

On my machine the Serialize_Should_serialize_World and Serialize_Should_serialize_Entities tests fail as the TextSerializer reads values with an invariant culture but written with the current culture.

It can be fixed by using a thin wrapper over StreamWriter overriding the FormatProvider property (in the StreamWriterWrapper class):

internal sealed class InvariantCultureStreamWriter : StreamWriter
{
    public InvariantCultureStreamWriter(Stream stream, Encoding encoding, int bufferSize, bool leaveOpen) : base(stream, encoding, bufferSize, leaveOpen)
    {
    }

    public override IFormatProvider FormatProvider => global::System.Globalization.CultureInfo.InvariantCulture;
}
@Doraku
Copy link
Owner

Doraku commented Sep 28, 2022

arg good catch >_< thanks for reporting it, It's even there in all the Parse call here https://github.com/Doraku/DefaultEcs/blob/master/source/DefaultEcs/Internal/Serialization/TextSerializer/Converter.cs#L118
I should have smell something fishy that the WriteLine didn't take one.

@Doraku Doraku added the bug Something isn't working label Sep 28, 2022
@Doraku Doraku closed this as completed in 2eb8c8a Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants