SYSTEM WARNING: 'date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in '/home/freecadweb/public_html/tracker/core.php' line 274

0002135: Units module is not properly considering the QLocale::groupSeparator() character - FreeCAD Tracker
FreeCAD Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002135FreeCADBugpublic2015-05-31 16:192017-01-16 18:52
ReporterSanguinario_Joe 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Platform64-bitOSLinux/KubuntuOS Version14.04.2 LTS
Product Version0.15 
Target VersionFixed in Version 
Summary0002135: Units module is not properly considering the QLocale::groupSeparator() character
DescriptionSome stupid languages, like Spanish, are not using the common dot decimal separator, but they have comma. That is well supported in FreeCAD, however some NaN stupid level languages, like Spanish, has a group separator (so called thousands separator), which seems is not well supported by FreeCAD.
Steps To Reproduce>>> q = Units.Quantity('1,2 m')
>>> q
1200 mm
>>> q = Units.Quantity('1.200 mm')
>>> q
1.2 mm
>>> q = Units.Quantity('1.200,0 mm')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
ValueError: syntax error
Additional InformationIt is a problem because QLocale::toString cannot be used.
Tagsdocumentation, locale
Attached Files

- Relationships

-  Notes
(0006181)
wmayer (administrator)
2015-06-02 15:17

I strongly disagree. The units parser must NOT get any locale specific strings as input.

The input must always be plain C strings because otherwise you cannot force the same behaviour on all platforms.

As an example consider a Python script. If the units parser supported locales and you build a string from a number in Python (which results into a C string) then the script behaves differently on different systems.

The next big problem is that you always have to extend the units parser to support all kind of special characters for decimal point and separator. There are languages that have other characters than dot or comma for this.

Locale specific strings must only be taken into account for our special Qt widgets that support units which are InputField and QuantitySpinBox.
(0006185)
Sanguinario_Joe (developer)
2015-06-03 11:05

"Locale specific strings must only be taken into account for our special Qt widgets that support units which are InputField and QuantitySpinBox."

I don't know if I'm wrong, but for the Python developers it is resulting in several inconsistencies that they should manually fix adding a lot of useless code.

Maybe I'm wrong, but there are not documentation about Gui::InputField or Gui::QuantitySpinBox either.
(0007659)
Kunda1 (manager)
2017-01-11 22:34

Reference:
http://www.freecadweb.org/api/da/dfa/classGui_1_1InputField.html [^]
http://www.freecadweb.org/api/d6/d3e/classGui_1_1QuantitySpinBox.html [^]

- Issue History
Date Modified Username Field Change
2015-05-31 16:19 Sanguinario_Joe New Issue
2015-06-02 15:17 wmayer Note Added: 0006181
2015-06-03 11:05 Sanguinario_Joe Note Added: 0006185
2017-01-11 22:34 Kunda1 Note Added: 0007659
2017-01-11 22:34 Kunda1 Tag Attached: documentation
2017-01-16 18:52 Kunda1 Tag Attached: locale


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker