Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: vcs_info and locales
- X-seq: zsh-workers 27905
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: vcs_info and locales
- Date: Sun, 25 Apr 2010 16:09:31 +0200
- In-reply-to: <20100425131944.GA55789@xxxxxxxxxxxxxxxxxxxx> (Phil Pennock's message of "Sun, 25 Apr 2010 06:19:44 -0700")
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20100424234017.776ae0ea@coriolan> <87aassncyk.fsf@xxxxxxxxxxxxxxxxxxxxxx> <20100425131944.GA55789@xxxxxxxxxxxxxxxxxxxx>
Phil Pennock wrote:
> 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?
>
> 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?
Probably true. Although, I'd expect programs you can use for scripting
to use untempered byte sequences. But then, where is the boundary for
programs that are used for scripting and pure user-interface programs...
`svn info' is probably a pretty blurry example already.
I'm not an expert but I think your proposal is sound. Here's a patch
that does exactly that.
It would be good if FranÃois could test whether this works for him.
Regards, Frank
---------- >8 ----------
From 95f005d1d8a5791eb8937b745adbd65ac62828f4 Mon Sep 17 00:00:00 2001
From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 25 Apr 2010 16:00:09 +0200
Subject: PATCH: vcs_info: Avoid locale related problems
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is to avoid problems with output from external commands with non-C
locales as reported by FranÃois Gannaz in workers-27900.
---
Functions/VCS_Info/vcs_info | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info
index a9e65e1..6585e7a 100644
--- a/Functions/VCS_Info/vcs_info
+++ b/Functions/VCS_Info/vcs_info
@@ -47,11 +47,16 @@ vcs_info () {
local pat
local -i found
local -a enabled disabled dps
- local -x usercontext vcs rrn
+ local -x usercontext vcs rrn LC_MESSAGES
local -ix maxexports
local -ax msgs
local -Ax vcs_comm
+ LC_MESSAGES=C
+ if [[ -n ${LC_ALL} ]]; then
+ local -x LANG LC_ALL
+ LANG=${LC_ALL}
+ fi
vcs='-init-'; rrn='-all-'
usercontext=${1:-default}
--
1.7.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author