NatLabRockies / NatLabRockies/OpenStudio
std::stod conversions are locale dependent (EpwFile)
Open
@tanushree04 is already working on this.
Since Jul 20, 2020.
severity - Normal Bug
- Dominant language
- C++
- Stars
- 646
- Forks
- 237
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 10
Description
On a VM I have a locale with LC_NUMERIC=fr_FR.UTF-8 (full locale below). This means the thousand separator is . and the decimal one is ,, so basically the opposite of the US.
This test fails as a result
$ ctest -VV -R "RubyTest-EpwFile_Test-file"
The assertion that fails is here:
the string "39.74" ends up converted as 39.0 because of the locale.
The std::stod calls that doesn't handle the decimal portion correctly is here, and it's called with std::string latitude = "39.74".
Locale
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_ALL=
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.