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

Re: Subversion completion don't work with UTF8 (and other) file names



On Fri, 26 Apr 2013 14:39:21 +0200
Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> Since the error message is about native encoding (US-ASCII here,
> due to the LC_ALL=C) to UTF-8, it concerns a file that is in the
> repository with a non-ASCII filename (internal encoding is UTF-8).
> 
> A solution might be to retrieve the computed LC_CTYPE with the
> "locale" command, then before executing svn, do the following:
> 
> _ Unset LC_ALL
> _ Set LC_CTYPE to the locale determined above.
> _ Set every other LC_* and LANG environment variables to "C".

Unsetting all the LC_* variables (including LC_ALL) and setting only
LC_CTYPE and LANG should be good enough, shouldn't it?  Something like:

_comp_locale() {
   # This exports new locale settings, so should only
   # be run in a subshell.  A typical use is in a $(...).
   local ctype=${${(f)"$(locale 2>/dev/null)"}:#^LC_CTYPE=*}
   unset -m LC_\*
   [[ -n $ctype ]] && eval export $ctype
   export LANG=C
}

seems to do the trick here:

LANG=C
LC_CTYPE=en_GB.UTF-8
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

I've actually lost track of which of the above we're trying to fix up
when we set the locale in this sort of case.  LC_COLLATE, certainly,
and I think LC_MESSAGES since otherwise we can't parse it (although
the disadvantage here is the output may be in a language the user
doesn't understand).

pws



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