- bug fixes and enhancements
for change notes and files see: http://newlisp.org/downloads/development/
Lutz
(set-locale) seems not to be working when starting from init.lsp
dmi@dc:newlisp$ locale
LANG=ru_RU.KOI8-R
LC_CTYPE="ru_RU.KOI8-R"
LC_NUMERIC=POSIX
LC_TIME=POSIX
LC_COLLATE="ru_RU.KOI8-R"
LC_MONETARY=POSIX
LC_MESSAGES=POSIX
LC_PAPER="ru_RU.KOI8-R"
LC_NAME="ru_RU.KOI8-R"
LC_ADDRESS="ru_RU.KOI8-R"
LC_TELEPHONE="ru_RU.KOI8-R"
LC_MEASUREMENT="ru_RU.KOI8-R"
LC_IDENTIFICATION="ru_RU.KOI8-R"
LC_ALL=
dmi@dc:newlisp$ pwd
/usr/share/newlisp
dmi@dc:newlisp$ cat init.lsp
(println "test")
(set 'll (set-locale))
dmi@dc:newlisp$ newlisp
test
newLISP v.8.7.10 on linux, execute 'newlisp -h' for more info.
> ll
"C"
> (set-locale)
"LC_CTYPE=ru_RU.KOI8-R;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;
LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;
LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;
LC_IDENTIFICATION=C"
>
...and seems not accepts well LC_COLLATE etc.
You have to put this in your init.lsp (it's what I did here in USA):
(set-locale ""ru_RU.KOI8-R")
Only doing (set-locale) without a parameter will just return the locale currently set in your system but not set it for newLISP. You may also try:
(set-locale "")
This will set the default locale of your OS.
newLISP v.8.7.10 on OSX UTF-8, execute 'newlisp -h' for more info.
> (set-locale)
"ru_RU.KOI8-R"
>
The LC_XXXX settings are handled differently well on different systems. Make sure you plug in the right numbers from these constants from locale.h
Lutz
Oh! Yes! This even described in manual :-)
(set-locale "") works fine just as I need.
Then, seems that I found a little side effect:
(set-locale) - w/o parameters, called from init.lsp or from any *.lsp file, specified as newlisp's argument - returns "C".
But in interactive mode (set-locale) seems to be working equal to (set-locale "") - i.e. get system locale and set it in newlisp environment - even when I interactively do (load "file-with-set-locale-command.lsp")
And... just for fun:
Cyrillic have a 5 main encodings: koi8, cp866, cp1251, iso-8859-5 and utf-8.
In fact on different servers at work (bringed by different admins) I has all of them in system shell environment :-)
This is how it works internally:
If newLISP is compiled as UTF-8 version set to the locale preset on the platform doing the 'C'-call: setlocale(LC_ALL, "")
If newLISP is compiled as non-UTF-8 version set locale "C" doing the 'C'-call setlocale(LC_ALL, "C")
load init.lsp which may contain (set-locale ...) statements
load other files from the command-line which may contain (set-locale ...) statements
Lutz