From 959d62048f90a0dd1558eed2682f56e42e4bbc4a Mon Sep 17 00:00:00 2001 From: frozen_dude Date: Mon, 29 Jul 2013 20:04:23 +0200 Subject: [PATCH 1/2] Fix for bad locale entry, LANG is a colon-separated list of prefered locales, LC_CTYPE is single entry, thus we need to remove all but one entry. There is also no idea setting it if it is already set. --- lib/misc.zsh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index a8678b8ec..3f23b1733 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -12,4 +12,14 @@ setopt long_list_jobs export PAGER="less" export LESS="-R" -export LC_CTYPE=$LANG +## how to interpret text characters +if [[ -z "$LC_CTYPE" -a -z "$LC_ALL" ]]; then # only define if undefined + export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG + [[ -z "$LC_CTYPE" ]] && \ + export LC_CTYPE=`locale -a | grep en_US.utf8 | head -1` + [[ -z "$LC_CTYPE" ]] && \ + export LC_CTYPE=`locale -a | grep en_US | head -1` + [[ -z "$LC_CTYPE" ]] && \ + export LC_CTYPE=C # default to internal encoding. +fi + From 6e33197827ec6665c8cbf4996d3e0fa554c3bd2d Mon Sep 17 00:00:00 2001 From: frozen_dude Date: Mon, 29 Jul 2013 20:27:31 +0200 Subject: [PATCH 2/2] Small derp --- lib/misc.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 3f23b1733..5a3382fcd 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -13,7 +13,7 @@ export PAGER="less" export LESS="-R" ## how to interpret text characters -if [[ -z "$LC_CTYPE" -a -z "$LC_ALL" ]]; then # only define if undefined +if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then # only define if undefined export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG [[ -z "$LC_CTYPE" ]] && \ export LC_CTYPE=`locale -a | grep en_US.utf8 | head -1`