tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Xlocale for NetBSD

I've made a fair start at porting FreeBSD's (port of Darwin's) xlocale to NetBSD. This started out as a frustration at ${WORK}, but continued at home after we gave up at ${WORK} and switched OSs instead to get working LC_COLLATE support.

The benefits of adopting xlocale would be:

 * Per-thread locale settings
 * Working LC_COLLATE settings
 * Use localedef(1) instead of mklocale(1), which allows...
 * Take locale definitions directly from CLDR

but, at least at the moment, has these drawbacks:

 * No ISO2022 codemap

that is, no ja_JP.ISO2022* locales; iconv, which is still based on Citrus, continues to work properly so far as I know.

The lack of working ISO2022 really surprised me; the problem seems to be that the CLDR tools can't generate a working codemap for ISO2022. I don't really know why that would be.

I have it building release and passing the few existing tests, except that it accepts previously forbidden sequences in Big5 encoding and chokes when you ask for ja_JP.ISO2022*. (Another possible issue is that the Citrus tests allow and test for 6-byte UTF-8 sequences, which are, strictly speaking, forbidden but not otherwise incompatible. I solved this problem by changing the code to pass the test, but it's easy to switch back if we want to go with the straight UTF-8 spec.)

I haven't applied the FreeBSD tests yet, and it needs new tests. (Actually, I haven't yet run a *complete* atf test run and compared results, so I may have missed some existing tests. Easy enough to do.)

The current diffs are available at

There are some additional issues I'm aware of with this particular set of diffs but am intending to fix, to wit,

* No compatibility support; e.g. existing test binaries crash
* Missing locale(5) man page taken from Illumos; licensing issues?
* Make sure the man pages match the code
* Haven't tried the installer

If there's sufficient interest in having this in-tree, I'll commit it on a branch and continue development there.


						Konrad Schroder

Home | Main Index | Thread Index | Old Index