Command line arguments depend on locale

Bill Nottingham notting at redhat.com
Thu Jan 31 16:43:44 UTC 2013


Simo Sorce (simo at redhat.com) said: 
> > You should *always* set LC_ALL=C when running an external command from
> > another program (and most probably from a shell script too).
> 
> Except when you shouldn't ...
> 
> If you are getting arguments that are locale dependent changing the
> locale will do you more harm than good, so now you need to parse
> arguments before changing locale, assuming you know what the locale of
> the arguments is and how to translate them to the C locale.
> 
> System commands should probably not change their syntax based on locale.
> Ping can very well document that the -i argument takes an interval using
> C locale and not do locale dependent parsing. It would be much more
> robust and if you are good enough to use the -i switch you probably know
> how to type 0.1 instead of 0,1 (or whatever format is in your locale) as
> well.

Right, output should be locale specific. Input command line args... seems
specious.

Bill


More information about the devel mailing list