set-locale with german umlauts and decimal point

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

set-locale with german umlauts and decimal point

Post 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
Hans-Peter

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post 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.
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

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

Locked