Skip to content

Default locale aware float parsing behaviour can be problematic #1009

@helaslo

Description

@helaslo

Seems like most instances of Unit::ParseString(const string& str, bool useDisplayLocale) are using the default, locale-aware behavior, and this has the potential to subtly break a lot of things.

Found this while testing csvstreamer, it wouldn't display any fractional values, but searching around most instruments which are using this are using the default value too.

This behavior is language dependent, if I run ngscopeclient with LANG=C ngscopeclient it works fine.

Broken behaviour (LANG=hu-HU.utf8 ngscopeclient):

Image

Running with LANG=C:

Image

Way to test it:

LANG=hu_HU.utf8 ngscopeclient

And the test input sequence:

CSV-NAME,CH1,CH2,CH3,CH4,CH5,CH6,CH7,CH8
CSV-CHANNELS,CH1,CH2,CH3,CH4,CH5,CH6,CH7,CH8
CSV-UNITS,V,V,V,V,V,V,V,V
CSV-DATA,1.2,-2,3,4,5,6,-7,8.4
CSV-DATA,1.2,-2,3,4,5,6,-7,8.4
CSV-DATA,1.2,-2,3,4,5,6,-7,8.4
CSV-DATA,1.2,-2,3,4,5,6,-7,8.4
CSV-DATA,1.2,-2,3,4,5,6,-7,8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiAPI improvementsbugSomething isn't workingcore

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions