Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

CultureInfo parsing/seralizing. #10

@LiamKarlMitchell

Description

@LiamKarlMitchell

A note when working with decimal numbers or potentially other formatted texts and encoding/decoding.
"Currency Symbols, Date/Time, Numbers" probably.

May want to ensure using an explicit CultureInfo when reading/saving data to text files e.g. ToString or parsing on numbers might have different formatting depending on the local OS language settings.
Which can cause data to bug out or not be compatible between different culture infos.

E.g. '100.123,0'

one thousand dot two
In Spain, you'll see 1.000'2
In Mexico will be seen as 1,000.2
In New Zealand will be seen as 1000.02

See: https://fastspring.com/blog/how-to-format-30-currencies-from-countries-all-over-the-world/

This could perhaps be provided as a way to set in the code.
Or just a note in the readme to the user.

This can set the threads culture info.
But could be a good idea to make it able to be set by the user of the code with a default to OS set locale/culture.

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo( "en-US" );
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo( "en-US" );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions