Page 1 of 1

set-locale with german umlauts and decimal point

Posted: Tue Sep 11, 2007 4:08 pm
by HPW
I am trying to use set-locale with german umlauts and decimal point.

Is it possible to set newLISP up this way with set-locale.

From locale.h from MINGW:
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5

Posted: Tue Sep 11, 2007 4:41 pm
by cormullion
Hi! It works as documented on MacOS:

Code: Select all

(println (div 1.2 3) (date (- (date-value) 15000000) 0 " %A %d. %B %Y"))
;-> 0.4 Thursday 22. March 2007

(set-locale "de_DE")
 
(println (div 1,2 3) (date (- (date-value) 15000000) 0 " %A %d. %B %Y"))
;-> 0,4 Donnerstag 22. März 2007
so if it doesn't work on Windows either the documents are wrong or the code is wrong. Well, you know what I mean - if it's supported and doesn't work, then it's a bug, but if it doesn't work because it isn't supported the documents should say so...

Posted: Tue Sep 11, 2007 5:01 pm
by HPW
The doc says that it can be fine-tuned.
The german locale work for me with the umlauts.
But then I also have the comma as the dezimal seperator.
Since I want to use newLISP together with autocad, I need the dezimal seperator together with umlauts.

Posted: Tue Sep 11, 2007 8:10 pm
by Lutz
Support for the LC_xxxx constants as additional parameter in (set-locale ...) is very different on different platforms. You would just have to experiment, putting different numbers and see how it behaves.

I believe on Windows different locale support is mainly implemented using different code pages selectable from somewhere in the control panel. I would try an English language locale to get the decimal point and use the codepage settings to get support for umlauts.

Lutz

Posted: Wed Sep 12, 2007 7:26 am
by HPW
Thanks for the hints.

I stay for main processing on locale "C" and change my number storage to strings. When I interface with autocad I switch locale temporarly to "GE" to get the umlauts in (source ..).