Re: [PATCH] am: invoke perl's strftime in C locale

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

 



On Tue, Jan 15, 2013 at 08:50:59AM -0800, Jeff King wrote:
> On Tue, Jan 15, 2013 at 05:42:12PM +0100, Antoine Pelisse wrote:
> 
> > > This puts all of perl into the C locale, which would mean error messages
> > > from perl would be in English rather than the user's language. It
> > > probably isn't a big deal, because that snippet of perl is short and not
> > > likely to produce problems, but I wonder how hard it would be to set the
> > > locale just for the strftime call.
> > 
> > Maybe just setting LC_TIME to C would do ...
> 
> Yeah, that is a nice simple solution. Dmitry, does just setting LC_TIME
> fix the problem for you?

Just setting LC_TIME environment variable instead of LC_ALL would end up
with unreliable solution because LC_ALL has the highest priority.

If keeping error messages from perl has the utmost importance, it could be
achieved by
-			perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 }
+			perl -M'POSIX qw(strftime :locale_h)' -ne '
+				BEGIN { setlocale(LC_TIME, "C"); $subject = 0 }
but the little perl helper script we are talking about hardly worths so
much efforts.


-- 
ldv

Attachment: pgpz6gy6fBARB.pgp
Description: PGP signature


[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]