darknesswind / NutCracker

fork from DamianXVI's squirrel decompiler
20 stars 9 forks source link

floating point output is wrong in some cultures #21

Open AdamMil opened 5 years ago

AdamMil commented 5 years ago

NutCracker uses the .OCP culture, which prints numbers according to the user's locale. So in countries that use the comma as the decimal separator rather than the period, a number like 1.25 gets printed as 1,250000. Then, NutCracker tries to find a period in it:

if (m_text.indexOf('.') == std::string::npos)
    m_text.append(L".0");

Since it doesn't find one, it adds ".0" to the end, resulting in "1,250000.0", which is not a valid Squirrel number.

NutCracker should use a fixed culture that always uses the period as the decimal separator.