From 1ac98037d5b5402d7e992ee865186213a2f900c3 Mon Sep 17 00:00:00 2001 From: Dylan Date: Wed, 10 Feb 2016 10:20:51 +1100 Subject: [PATCH] Possible fix for the locale issue --- fetch | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fetch b/fetch index d8b45f94..6de042bd 100755 --- a/fetch +++ b/fetch @@ -23,8 +23,6 @@ # Speed up script by not using unicode export LC_ALL=C export LANG=C -export LANGUAGE=C - # Config Options {{{ @@ -1698,6 +1696,9 @@ getascii () { print="${ascii_color}$(<"$ascii")" fi + # Set locale to get correct padding + export LC_ALL="en_US.UTF8" + # Turn the file into a variable. ascii_strip=$(<"$ascii") @@ -1706,20 +1707,23 @@ getascii () { ascii_strip=${ascii_strip//\\} # Get length of longest line - length="$(LC_ALL="en_US.UTF8" wc -L 2>/dev/null <<< "$ascii_strip")" + length="$(wc -L 2>/dev/null <<< "$ascii_strip")" # Get the height in lines - lines="$(($(LC_ALL="en_US.UTF8" wc -l 2>/dev/null <<< "$ascii_strip") + 1))" + lines="$(($(wc -l 2>/dev/null <<< "$ascii_strip") + 1))" # Fallback to using awk on systems without 'wc -L' [ -z "$length" ] && \ - length="$(LC_ALL="en_US.UTF8" awk 'length>max{max=length}END{print max}' <<< "$ascii_strip")" + length="$(awk 'length>max{max=length}END{print max}' <<< "$ascii_strip")" # Set the text padding padding="\033[$((length + gap))C" # Print the ascii printf "%b%s" "$print" + + # Set locale to get correct padding + export LC_ALL=C } @@ -2459,4 +2463,3 @@ fi # }}} -