[Top][All Lists]

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

Re: [Nmh-workers] hardcoding en_US.UTF-8 in test cases

From: Oliver Kiddle
Subject: Re: [Nmh-workers] hardcoding en_US.UTF-8 in test cases
Date: Fri, 08 Feb 2013 03:10:28 +0100

Ken Hornstein wrote:
> Huh, okay ... forgive my US-centricism, but at least on every system
> here we have tons of locales installed so I figured that was the case
> everywhere, and I picked something I figured was pretty universal.  May

It probably depends on how the system was installed, with some installers
including a full set regardless. Minimal sets of locales appears to be
fairly prevalent on systems I have access to.

> May
> I ask how come you have a Finnish locale but not a US one?  This isn't
> some harsh feelings left over from the War of 1812, is it? :-)

:-) The Finnish locale is there for my wife. 
I've probably got harsher feelings for your mixed up month day year date
formats. Though, the C locale probably specifies that too.
> FWIW, none of the systems I have access to (even the Linux ones) have a
> C.UTF-8 locale.  It's not clear to me how standardized those locale names
> are.

I only see it on my recent Debian box. Like C, it can't be removed with
dpkg-reconfigure -p low locales.

>         address@hidden
> Not sure if that helps anything or not.  On some systems I see a locale
> just called "UTF-8", but that seems to be rare.

I've not seen "UTF-8" anywhere. @euro is the only modifier I've seen but it
still seems to be common.

I've attempted a script for finding a locale (see below). It will prefer
C.UTF-8 or plain UTF-8  but not en_xx as that complicates the script
quite a bit.

To use it, you would do:
eval `./findutf8locale` || skip test


# findutf8locale - A script that attempts to find a suitable locale for use
#                  with tests that require UTF-8 support

# if Nmh has no multibyte support, fail
./getcwidth a >/dev/null 2>&1 || exit 1
# if the current locale does the job, use it
[ "`./getcwidth ä 2>&1`" = 1 ] && exit 0

if LOCALE=`command -v locale 2>/dev/null`; then
  LOCALE="$LOCALE -a | sed 's/utf8/UTF-8/'"
elif [ -d /usr/lib/locale ]; then
  LOCALE="ls -1 /usr/lib/locale"
  exit 1

$LOCALE | grep UTF-8 | LC_COLLATE=C sort | uniq | while read line; do
  if [ "`LC_CTYPE="$line" ./getcwidth ä 2>&1`" = 1 ]; then
    echo LC_CTYPE="$line"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]