git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
YDYann Droneaud <yann@droneaud.fr>
Date
May 19, 2010, 15:16 UTC
Message-ID
<1274282202.4275.68.camel@localhost>
In-Reply-To
<1274215797.16337.16.camel@localhost>
Le mardi 18 mai 2010 à 22:49 +0200, Yann Droneaud a écrit :
Show 19 quoted lines
> 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
Previous: Yann DroneaudNext: Junio C Hamano
Message 9 of 23 in “t9129: fix UTF-8 locale detection”
  1. t9129: fix UTF-8 locale detectionYann Droneaud, May 18, 2010
  2. Michael J GruberMay 18, 2010
  3. Yann DroneaudMay 18, 2010
  4. t9129: fix UTF-8 locale detectionYann Droneaud, May 18, 2010
  5. Linus TorvaldsMay 18, 2010
  6. Andreas SchwabMay 18, 2010
  7. Linus TorvaldsMay 18, 2010
  8. Yann DroneaudMay 18, 2010
  9. Yann DroneaudMay 19, 2010
  10. Re* [PATCH] t9129: fix UTF-8 locale detectionJunio C Hamano, Jun 2, 2010
  11. Yann DroneaudMay 24, 2010
  12. Michael J GruberMay 25, 2010
  13. 0/4 en_US.UTF-8 locale detectionYann Droneaud, Jan 6, 2011
  14. 1/4 test: add a library to detect an en_US.UTF-8 localeYann Droneaud, Jan 6, 2011
  15. Junio C HamanoJan 7, 2011
  16. 2/4 test-lib.sh: add test_utf8() functionYann Droneaud, Jan 6, 2011
  17. Junio C HamanoJan 7, 2011
  18. 3/4 test: use test_utf8 and GIT_LC_UTF8 where an en_US.UTF-8 locale is requiredYann Droneaud, Jan 6, 2011
  19. Junio C HamanoJan 7, 2011
  20. 4/4 t9129: use "$PERL_PATH" instead of "perl"Yann Droneaud, Jan 6, 2011
  21. Junio C HamanoJan 7, 2011
  22. Yann DroneaudMay 18, 2010
  23. Miles BaderMay 19, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.