Subject: Re: [PATCH] t9129: fix UTF-8 locale detection

From: Yann Droneaud <[email-masked]>
Date: Tue, 18 May 2010 19:08:06 +0200

Le mardi 18 mai 2010 à 18:05 +0200, Michael J Gruber a écrit :
> Yann Droneaud venit, vidit, dixit 18.05.2010 16:41:
> > Since I don't have en_US.utf8, some tests failed:

> > 
> > On my system locale -a reports:
> > 
> >    en_US
> >    en_US.ISO-8859-1
> >    en_US.UTF-8
> > 
> 
> locale -a|grep en_US
> en_US
> en_US.iso88591
> en_US.iso885915
> en_US.utf8
> 
> This is on Fedora 13, which is not exactly exotic. What is your system?
> 

Mandriva Linux 2009.1 and 2010.0, see results of locale -a :

http://pastebin.mandriva.com/18557
http://pastebin.mandriva.com/18555

I've double check with Mandriva's developers who have

  en_US
  en_US.iso88591
  en_US.utf8
  en_US.UTF-8

> > According to Wikipedia utf8 is not a correct name
> > for the UTF-8 encoding:
> > http://en.wikipedia.org/wiki/UTF-8#Official_name_and_incorrect_variants
> > 

UTF-8 seems to be the correct name.

> >  
> > -if locale -a |grep -q en_US.utf8; then
> > +if locale -a |grep -q en_US.UTF-8; then
> >  	test_set_prereq UTF8
> >  else
> >  	say "UTF-8 locale not available, test skipped"
> 
> Funny thing is the test succeeds for me, even when run within
> LANG=en_US.iso88591.

> So I'd suggest to use
> 
> -if locale -a |grep -q en_US.utf8; then
> +if locale -a |egrep -q 'en_US.utf8|en_US.UTF-8'; then
> 
> and embrace for more variants to appear down the road...
> 

Using en_US.UTF-8 seems more accurate when I wrote the patch since, as I
wrote before, compare_svn_head_with() is using LC_ALL=en_US.UTF-8.
So en_US.UTF-8 is an alias for en_US.utf8, whatever the canonical
version is.

So let's go for another version.

-- 
Yann Droneaud