oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
https://www.graalvm.org/ruby/
Other
3.01k stars 184 forks source link

Parsing floats fails when using locales with a decimal separator different than `.` #3512

Closed eregon closed 6 months ago

eregon commented 6 months ago

We had a report that truffleruby does not work with LANG=cs_CZ.UTF-8 (which uses , instead of . as the decimal separator):

$ LANG=en_US.UTF-8 ruby -e 'p 3.4'
3.4
$ LANG=cs_CZ.UTF-8 ruby -e 'p 3.4'
truffleruby: -e:1: could not parse the float '3.4' (SyntaxError)
$ LANG=fr_FR.UTF-8 ruby -e 'p 3.4'
truffleruby: -e:1: could not parse the float '3.4' (SyntaxError)

This is related to how TruffleRuby sets the locale and how Prism depends on it for strtod: https://github.com/ruby/prism/issues/2638