Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: vcs_info and locales



Le 2010-04-25, Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> a Ãcrit :
> On 2010-04-25 at 10:38 +0200, Frank Terbeck wrote:
> > Anyway, could you try the following patch for the locale problem? I
> > think it should solve the issue once and for all.
> 
> I have one concern, which leads to the question: is it really necessary
> to set LC_ALL instead of LC_MESSAGES?

Yes it is. I used LC_ALL here because that was the only one that made "svn
info" switch to English when default locale is set to "fr_FR.utf8".

% LC_ALL=C svn info     
Path: .
[...]
% LC_MESSAGES=C LANG=C LC_CTYPE=C svn info
CheminÂ: .
[...]
 
> The main problem is that when you override LC_CTYPE to C, you lose any
> potential UTF-8 support, unless the tool just passes through the binary
> data.
> 
> I think the safest algorithm is not to set LC_ALL but instead:
>  * set LC_MESSAGES=C
>  * if LC_ALL is set and is not C, set LANG=$LC_ALL, unset LC_ALL
> 
> Make sense?

I had not tested what non-ASCII encoding became, and you're right that the
shell can't handle utf-8 anymore.

% LC_ALL=C svn log  
------------------------------------------------------------------------
r1 | zamansky | 2010-04-25 20:46:26 +0200 (Sun, 25 Apr 2010) | 2 lines
Accentu?\195?\169 l?\195?\160 aussi. ?\195?\128 tester.

So setting LC_ALL=C globally is indeed a bad idea. But why not just locally in
VCS_INFO_get_data_svn? I don't think that behavior would hurt much vcs_info.
The only problem I can think of is when the repository name is not un ASCII,
and doing this really calls for troubles ;-)
With a "franÃois" repository and LC_ALL=C:
% vcs_info command ; vcs_info_lastmsg                          
$vcs_info_msg_0_: "svn:(franfranÃois37ois:1) "

The other solution would be to use the line numbers to fetch the data from "svn
info".
--
FranÃois



Messages sorted by: Reverse Date, Date, Thread, Author