| Newsgroups |
gmane.lisp.clisp.devel |
| Message-ID |
<761c88a3503d4d90ab7408b1895ac4d6@HE105658.emea1.cds.t-internal.com> |
Hi,
I wanted to query the list about how to deal with the encodings that libraries uses.
For instance, gnulib/regex uses the following code to store an error message
into a user-supplied buffer:
regerror (int errcode, ..., char *_Restrict_ errbuf, size_t errbuf_size) {
... msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
}
But how was that text encoded into the library? What will gettext select?
Wouldn't clisp need to provide and export a new object named O(locale_encoding)?
Currently, clisp initializes O(misc_encoding) and all the others according to locale
information *only* if no command line overrides that setting,
witness encoding.c around line 2650:
begin_system_call();
locale_encoding = locale_charset(); /* depends on environment variables */
end_system_call();
pushSTACK(encoding_from_name(locale_encoding,"locale"));
[...]
O(misc_encoding) =
(argv_encoding_misc == NULL ? (object)STACK_0
: encoding_from_name(argv_encoding_misc,"*MISC-ENCODING*"));
Hence, if you use -E, you cannot easily find out what that original locale is that
the libraries use.
It looks like O(locale_encoding) is the one that would best match the above
function regerror(), not the existing O(misc_encoding).
I've not given thought to what can happen when a program changes LANG or LC_xyz after
the start. Depending on the library's code, the initial binding may remain in effect
(assuming they never rebind). Hence there's no provision for changing O(locale_encoding)
(except it needs to be overwritten when starting with an image).
Any comments?
Is moving away from misc_encoding too much?
Would it be wiser to allow clisp's early command line parsing code to set a different
locale, i.e. not(!) obey $LANG&LC_*, before any foreign modules initialize? Then
O(misc_encoding) already fits the bill, except from a missing call to setlocale().
Jörg
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel