Problem with negative values in InputField

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
ralvejd
Posts: 58
Joined: Wed Feb 20, 2013 10:31 pm
Location: Sweden

Re: Problem with negative values in InputField

Postby ralvejd » Wed Jul 30, 2014 10:09 am

I have had problems with the minus sign since I started using FreeCAD.
QD solution I've used is to copy-paste.

FreeCAD minus −
Swedish minus -
Hope the difference is visible in all browsers :?


OS: Debian GNU/Linux 7.6 (wheezy)
Platform: 64-bit
Version: 0.14.2751 (Git)
Branch: master
Hash: 16e873310689f055fb249c69a5c8422b3eef1fa7
Python version: 2.7.3
Qt version: 4.8.2
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.5.4
sorry for my outrageous English, but I have a bad excuse
wmayer
Site Admin
Posts: 15747
Joined: Thu Feb 19, 2009 10:32 am

Re: Problem with negative values in InputField

Postby wmayer » Wed Jul 30, 2014 10:41 am

OK, it's the same unicode char.
jmaustpc
Posts: 9639
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Problem with negative values in InputField

Postby jmaustpc » Wed Jul 30, 2014 11:28 am

wmayer wrote:OK, it's the same unicode char.
Hi Werner, are you sure? They display differently for me in Firefox so wouldn't that mean that they must have a different Unicode values?

Jim
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Problem with negative values in InputField

Postby jriegel » Wed Jul 30, 2014 11:50 am

The swedisch have their own minus :o Impressive! :D

I will add that unicode to the parser....
Stop whining - start coding!
User avatar
ralvejd
Posts: 58
Joined: Wed Feb 20, 2013 10:31 pm
Location: Sweden

Re: Problem with negative values in InputField

Postby ralvejd » Wed Jul 30, 2014 12:17 pm

The swedisch have their own minus :o Impressive! :D
Yes, at least in Debian wheezy.

This and all other local deviations is something that the UN should standardize. :mrgreen:
sorry for my outrageous English, but I have a bad excuse
obbe
Posts: 2
Joined: Wed Jul 30, 2014 12:17 pm

Re: Problem with negative values in InputField

Postby obbe » Wed Jul 30, 2014 12:23 pm

I have the exact same (I presume) error on Mac OSX using Swedish locale. Filed a bug here: http://www.freecadweb.org/tracker/view.php?id=1627

Thanks to wmayer for linking them. :)
wmayer
Site Admin
Posts: 15747
Joined: Thu Feb 19, 2009 10:32 am

Re: Problem with negative values in InputField

Postby wmayer » Wed Jul 30, 2014 1:05 pm

jmaustpc wrote:
wmayer wrote:OK, it's the same unicode char.
Hi Werner, are you sure? They display differently for me in Firefox so wouldn't that mean that they must have a different Unicode values?

Jim
I meant it's the same unicode char as DevJohan has -- just in case there are multiple minus signs in unicode defined.
wmayer
Site Admin
Posts: 15747
Joined: Thu Feb 19, 2009 10:32 am

Re: Problem with negative values in InputField

Postby wmayer » Wed Jul 30, 2014 6:17 pm

Under Windows one can set the "minus" inside the control panel for negative numbers. After this change I can confirm all the trouble.
wmayer
Site Admin
Posts: 15747
Joined: Thu Feb 19, 2009 10:32 am

Re: Problem with negative values in InputField

Postby wmayer » Thu Jul 31, 2014 9:30 am

Something I dug out from the forum: viewtopic.php?f=10&t=572&start=10#p4045
wmayer
Site Admin
Posts: 15747
Joined: Thu Feb 19, 2009 10:32 am

Re: Problem with negative values in InputField

Postby wmayer » Thu Jul 31, 2014 10:26 am

A few more things we have to beware of:

Code: Select all

from PySide import QtCore


print "Negative signs:"
for i,j in QtCore.QLocale.Language.values.iteritems():
  l=QtCore.QLocale(j)
  if ord(l.negativeSign()) != ord('-'):
     i, l.negativeSign().encode("utf-8")
     print ""



print "Positive signs:"
for i,j in QtCore.QLocale.Language.values.iteritems():
  l=QtCore.QLocale(j)
  if ord(l.positiveSign()) != ord('+'):
     i, l.positiveSign().encode("utf-8")
     print ""


print "Decimal points:"
for i,j in QtCore.QLocale.Language.values.iteritems():
  l=QtCore.QLocale(j)
  if not ord(l.decimalPoint()) in (ord(','),ord('.')):
     i, l.decimalPoint().encode("utf-8")
     print ""


print "Group separator:"
for i,j in QtCore.QLocale.Language.values.iteritems():
  l=QtCore.QLocale(j)
  if not ord(l.groupSeparator()) in (ord(','),ord('.')):
     i, l.groupSeparator().encode("utf-8")
     print ""


print "Percent:"
for i,j in QtCore.QLocale.Language.values.iteritems():
  l=QtCore.QLocale(j)
  if ord(l.percent()) != ord('%'):
     i, l.percent().encode("utf-8")
     print ""


print "Zero digit:"
for i,j in QtCore.QLocale.Language.values.iteritems():
  l=QtCore.QLocale(j)
  if ord(l.zeroDigit()) != ord('0'):
     i, l.zeroDigit().encode("utf-8")
     print ""

Script wrote: Negative signs:
('NorthernSami', '\xe2\x88\x92')
('Swedish', '\xe2\x88\x92')
('Faroese', '\xe2\x88\x92')
('Latvian', '\xe2\x88\x92')
('Colognian', '\xe2\x88\x92')
('RhaetoRomance', '\xe2\x88\x92')
('Icelandic', '\xe2\x88\x92')
('Lithuanian', '\xe2\x88\x92')
('Greenlandic', '\xe2\x88\x92')
('SwissGerman', '\xe2\x88\x92')
('NorwegianNynorsk', '\xe2\x88\x92')
('Nynorsk', '\xe2\x88\x92')

Positive signs:


Decimal points:
('Urdu', '\xd9\xab')
('Arabic', '\xd9\xab')
('Pashto', '\xd9\xab')
('Bengali', '\xd9\xab')
('Persian', '\xd9\xab')
('Assamese', '\xd9\xab')
('Kurdish', '\xd9\xab')

Group separator:
('Walser', '\xe2\x80\x99')
('Estonian', '\xc2\xa0')
('CentralMoroccoTamazight', '\xc2\xa0')
('Zarma', '\xc2\xa0')
('Yangben', '\xc2\xa0')
('Byelorussian', '\xc2\xa0')
('Ukrainian', '\xc2\xa0')
('Bulgarian', '\xc2\xa0')
('KoyraboroSenni', '\xc2\xa0')
('French', '\xc2\xa0')
('Duala', '\xc2\xa0')
('Sesotho', '\xc2\xa0')
('Finnish', '\xc2\xa0')
('JolaFonyi', '\xc2\xa0')
('NorthernSami', '\xc2\xa0')
('Aghem', '\xc2\xa0')
('Slovak', '\xc2\xa0')
('Urdu', '\xd9\xac')
('Polish', '\xc2\xa0')
('Kirghiz', '\xc2\xa0')
('Xhosa', '\xc2\xa0')
('Swedish', '\xc2\xa0')
('Fulah', '\xc2\xa0')
('Zulu', '\xc2\xa0')
('Norwegian', '\xc2\xa0')
('SouthNdebele', '\xc2\xa0')
('Afrikaans', '\xc2\xa0')
('Uzbek', '\xc2\xa0')
('NorthernSotho', '\xc2\xa0')
('Latvian', '\xc2\xa0')
('Colognian', '\xc2\xa0')
('Kabyle', '\xc2\xa0')
('Arabic', '\xd9\xac')
('RhaetoRomance', '\xe2\x80\x99')
('Bafia', '\xc2\xa0')
('Breton', '\xc2\xa0')
('Pashto', '\xd9\xac')
('Ewondo', '\xc2\xa0')
('Hungarian', '\xc2\xa0')
('Russian', '\xc2\xa0')
('Kazakh', '\xc2\xa0')
('Basaa', '\xc2\xa0')
('Bengali', '\xd9\xac')
('Siswati', '\xc2\xa0')
('SwissGerman', '\xe2\x80\x99')
('Tsonga', '\xc2\xa0')
('Morisyen', '\xc2\xa0')
('Czech', '\xc2\xa0')
('Tachelhit', '\xc2\xa0')
('Persian', '\xd9\xac')
('Mongolian', '\xc2\xa0')
('NorwegianNynorsk', '\xc2\xa0')
('LastLanguage', '\xc2\xa0')
('Setswana', '\xc2\xa0')
('Tasawaq', '\xc2\xa0')
('Akan', '\xc2\xa0')
('NorwegianBokmal', '\xc2\xa0')
('Assamese', '\xd9\xac')
('Kurdish', '\xd9\xac')
('Walamo', '\xe2\x80\x99')
('KoyraChiini', '\xc2\xa0')
('Kwasio', '\xc2\xa0')
('Portuguese', '\xc2\xa0')
('Venda', '\xc2\xa0')
('Nynorsk', '\xc2\xa0')

Percent:
('Urdu', '\xd9\xaa')
('Tibetan', '\xd9\xaa')
('Burmese', '\xd9\xaa')
('Arabic', '\xd9\xaa')
('Oriya', '\xd9\xaa')
('Pashto', '\xd9\xaa')
('Bengali', '\xd9\xaa')
('Persian', '\xd9\xaa')
('Assamese', '\xd9\xaa')
('Kurdish', '\xd9\xaa')

Zero digit:
('Bodo', '\xe0\xa5\xa6')
('Urdu', '\xdb\xb0')
('Tibetan', '\xe0\xbc\xa0')
('Burmese', '\xe1\x81\x80')
('Arabic', '\xd9\xa0')
('Oriya', '\xe0\xad\xa6')
('Pashto', '\xdb\xb0')
('Bengali', '\xe0\xa7\xa6')
('Persian', '\xdb\xb0')
('Assamese', '\xe0\xa7\xa6')
('Kurdish', '\xd9\xa0')