newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: HPW on September 11, 2007, 09:08:19 AM

Title: set-locale with german umlauts and decimal point
Post by: HPW on September 11, 2007, 09:08:19 AM
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
Title:
Post by: cormullion on September 11, 2007, 09:41:59 AM
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...
Title:
Post by: HPW on September 11, 2007, 10:01:46 AM
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.
Title:
Post by: Lutz on September 11, 2007, 01:10:33 PM
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
Title:
Post by: HPW on September 12, 2007, 12:26:53 AM
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 ..).