1 Nov 2006 21:06
The 'C' locale (was Re: CVS: herc.mirbsd.org: src)
Thorsten Glaser dixit:
>At the moment, this is set to 2, which basically means, the 'C'
>locale is actually an 'en_US.ISO-8859-1' locale. If this is set
>to 1, the isalpha() etc. functions and nl_langinfo(CODESET) will
>return ASCII, but conversion functions, such as btowc(3), still
>accept and/or return latin1 characters. If set to 0, 7-bit ASCII
>will be enforced for the 'C' locale, as per its specification.
>
>Because we only have two locales, 'C' and 'en_US.UTF-8', this
>means that we _will_ go the Plan 9 way of eventually switching
>totally to UTF-8. I think after wscons has been changed to some
>kind of uwscons, we can make the switch to 0, but for now, I'll
>leave it at 2.
>
>Note: for future MirOS-current snapshots, this may be lowered
> to 1, and raised back to 2 for releases, until suffici-
> ently tested and ports are converted.
This means that, eventually, if using MirOS, one *must* use an
unicode-capable terminal for editing *any* non-7bit-ASCII docu-
ments, even if using iconv(3). Not yet, though (since our nati-
ve terminals aren't unicode capable yet, only uxterm).
This will indeed lead to information loss, even if doing some-
thing like
$ ed -c iso-8859-1 latin1file.txt
which I'll implement soon, unless run in a utf-8 terminal.
On the other hand, the 'C' locale is specified as 7bit, with
no "surprises" to the user, and this latin1 kludge is only in-
troduced(!) to be compatible to the non-locale-aware-at-all OS
we have forked off (OpenBSD). The 'en_US.UTF-8' locale I added,
which is the only other one we have, is the (only) proper way
of doing things. (Note that 'xx_XX.CESU-8' is valid too, and
probably even a better guess.)
Comments? (Benny liked to discuss this.)
//mirabile
PS: Should we return "en_US.UTF-8" for LC_* other than LC_CTYPE
as well, for example, LC_MESSAGES? In the current implemen-
tation, one has to overload the weak setlocale() function to
do that - this _is_ consistent behaviour since nothing hand-
les LC_MESSAGES et al. anyway.
--
--
I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence. -- Coywolf Qi Hunt
RSS Feed