set-locale with german umlauts and decimal point

Started by HPW, September 11, 2007, 09:08:19 AM

Previous topic - Next topic

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:
Quote
#define   LC_ALL      0

#define LC_COLLATE   1

#define LC_CTYPE   2

#define   LC_MONETARY   3

#define   LC_NUMERIC   4

#define   LC_TIME      5
Hans-Peter

cormullion

#1
Hi! It works as documented on MacOS:


(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...

HPW

#2
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.
Hans-Peter

Lutz

#3
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

HPW

#4
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 ..).
Hans-Peter