[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: autoconf test for finding UTF-8 locale?
From: |
Bruno Haible |
Subject: |
Re: autoconf test for finding UTF-8 locale? |
Date: |
Mon, 21 Nov 2022 20:16:19 +0100 |
Hi Werner,
> Thanks! I have attached my current results – completely untested
It's not clear what you are looking for, with your macro:
- an English UTF-8 locale (which does obey $LANGUAGE), or
- a C.UTF-8 locale (which does not obey $LANGUAGE; I assume
https://sourceware.org/bugzilla/show_bug.cgi?id=29777 will
get fixed soon).
If want you want is either of both, then it's just as promising to look
for an English UTF-8 locale (since that exists on most OSes for ca. 20
years), and use "C.UTF-8" only as a fallback e.g. for when the first
search did not find anything (e.g. on Alpine Linux). In other words, in
this case, I would write two different Autoconf macros and combine the
results of both.
> Parts marked with 'XXX' are places where I am completely clueless what
> to do.
nl_langinfo (CODESET): I would test for "UTF-8" or "utf8" (for HP-UX) or
"65001" (for Windows); see gnulib/lib/localcharset.c.
Testing whether the locale is UTF-8: I would
- test whether MB_CUR_MAX > 1
- and test the wcswidth() of some strings, like the test strings found in
gnulib/tests/uniwidth/test-u8-width.c.
> Finally, I wonder how this could be tested on various platforms. Is
> there an OS 'farm' to which a configure script could be sent,
> collecting all results of them?
You have access to many OSes, by configuring/running a package on the GCC
compile farm https://cfarm.tetaneutral.net/ . It is open to GNU package
maintainers other than GCC. Other than that, some people also have VMs;
you could ask for their help on platform-testers _at_ gnu.org.
Bruno