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

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

 



Le mardi 18 mai 2010 à 22:49 +0200, Yann Droneaud a écrit :
> Le mardi 18 mai 2010 à 10:45 -0700, Linus Torvalds a écrit :
> > 
> > On Tue, 18 May 2010, Yann Droneaud wrote:
> > >  
> > > -if locale -a |grep -q en_US.utf8; then
> > > +if locale -a |grep -qE '^en_US\.(utf|UTF)-?8$'; then
> > 
> > While -E is POSIX, I suspect that it's not universal. iirc, you still have 
> > some really crap fileutils tools coming with Solaris, for example. 
> > 
> 
> You're right, Solaris's own grep doesn't known about -E nor -e.
> 
> And it even doesn't know about -q : 
> 
>  $ grep -q                                                     
>  grep: illegal option -- q
>  Usage: grep -hblcnsviw pattern file . . .
> 

Integrating Linus's remarks and some autoconf[1][2] hints, here is a
proposal for a portable test:

   if locale -a |grep -i 'en_US\.utf-*8' > /dev/null ; then

It should be as portable as possible without too much work.


[1] egrep
<http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Usual-Tools.html#index-g_t_0040command_007begrep_007d-1706>

[2] grep
<http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Usual-Tools.html#index-g_t_0040command_007bgrep_007d-1712>

Regards.

-- 
Yann Droneaud




--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]