Skip to content

Floating point properties can be parsed incorrectly #42

@jrshoare

Description

@jrshoare

When Windows regional settings do not have '.' as the decimal symbol - as is common in many European countries, for example - floating point properties such as OpenSlideImage.MicronsPerPixelX and OpenSlideImage.MicronsPerPixelY are parsed incorrectly from their string equivalent properties. This stems from the use of the double.TryParse(string, out double) method which is culture sensitive.

The OpenSlide library uses the g_ascii_dtostr method to convert doubles to strings which ensures that '.' is used as the decimal point.

The properties should parse the string using the invariant culture in double.TryParse(string, NumberStyles, IFormatProvider, out double) where IFormatProvider is CultureInfo.InvariantCulture which uses '.' as the decimal symbol.

Consider doing similar for the float and double GetProperty extension methods too.

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