oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.

Home Page:https://www.graalvm.org/ruby/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

eregon opened this issue · comments

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: ruby/prism#2638