kswoll / WootzJs

C# to Javascript Compiler implemented via Roslyn
MIT License
110 stars 21 forks source link

Wrong float/double generation depending on local culture settings. #9

Closed Danielku15 closed 10 years ago

Danielku15 commented 10 years ago

Here in Austria we use comma as decimal separator instead of the dot. C# will use local culture settings when calling ToString on float and doubles. This causes the JavaScript to contain "0,5" instead of "0.5" which is syntactically wrong. In JsRenderer.cs#322 use culture specific string conversion to fix this problem:

output.Append(Convert.ToString(node.Value, CultureInfo.InvariantCulture));
kswoll commented 10 years ago

This is tricky to write a unit test for, so please let me know if this fixes it.