GNOME Bugzilla – Bug 632658
Thousands separators cannot be parsed by our CLI tools
Last modified: 2012-12-11 02:28:18 UTC
...unless the locale's thousands separator is " ". I fixed this in 5.91.0, but it was reverted again in df984fc20501db04fc94fba1f30f48fd19d95da3 For instance, this should not return parser error: LC_NUMERIC=en_US gcalctool -s "99,999.00"
For this to work the parser needs to be aware of this (In some locales the separator is '.'). I've failed to do it and the comments you added indicated you had much the same problem! The solution is to improve the parser, see bug 589569.
Created attachment 226144 [details] [review] Ignore thousands separator in CLI tools.
Review of attachment 226144 [details] [review]: Can you update this for the vala port? Thanks.
Created attachment 226432 [details] [review] Ignore thousands separator in CLI tools.
Review of attachment 226432 [details] [review]: ::: src/equation.vala @@ -108,3 @@ public int wordlen; public AngleUnit angle_units; - private string expression; There is no need to make this public, you should modify the string before creating the object. ::: src/gcalccmd.vala @@ +24,3 @@ + if (tsep_string == null || tsep_string == "") + tsep_string = " "; + e.expression = string.joinv ("", e.expression.split(tsep_string, 0)); Use string.replace instead - it will be simpler to read
Created attachment 226504 [details] [review] Ignore thousands separator in CLI tools. Uses string.replace () method.
Review of attachment 226504 [details] [review]: ::: src/equation.vala @@ -108,3 @@ public int wordlen; public AngleUnit angle_units; - private string expression; Same as last time. Keep this private and modify the expression before creating an Equation object.
Created attachment 230832 [details] [review] Ignore thousands separator in CLI tools.
Review of attachment 230832 [details] [review]: Thanks Arth!
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.