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 Sat, 04 May 2013 04:15:01 +0200
Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> Is the locale command that portable?.

That's easy to work around.

> I'm not sure this is even necessary in the cases where it is just calling
> svnadmin help or svn help rather than svn status.
> 
> Originally, _subversion set LC_MESSAGES for these commands but LC_ALL
> overrides LC_MESSAGES. Would it be better to do it as follows:
>   LC_CTYPE=${LC_ALL:-${LC_CTYPE:-$LANG}} LC_ALL= LC_MESSAGES=C _call_program ...

So that goes back to my previous question, what do we actually need to
change to make it work regardless of locale?

diff --git a/Completion/Base/Utility/_comp_locale b/Completion/Base/Utility/_comp_locale
index 1987043..7cf8511 100644
--- a/Completion/Base/Utility/_comp_locale
+++ b/Completion/Base/Utility/_comp_locale
@@ -7,7 +7,14 @@
 # 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
+local ctype
+
+if ctype=${${(f)"$(locale 2>/dev/null)"}:#^LC_CTYPE=*}; then
+    unset -m LC_\*
+    [[ -n $ctype ]] && eval export $ctype
+else
+    ctype=${LC_ALL:-${LC_CTYPE:-$LANG}}
+    unset -m LC_\*
+    export LC_CTYPE=$ctype
+fi
 export LANG=C

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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