Possible fix for the locale issue
This commit is contained in:
parent
b61f33854a
commit
1ac98037d5
1 changed files with 9 additions and 6 deletions
15
fetch
15
fetch
|
@ -23,8 +23,6 @@
|
||||||
# Speed up script by not using unicode
|
# Speed up script by not using unicode
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export LANG=C
|
export LANG=C
|
||||||
export LANGUAGE=C
|
|
||||||
|
|
||||||
|
|
||||||
# Config Options {{{
|
# Config Options {{{
|
||||||
|
|
||||||
|
@ -1698,6 +1696,9 @@ getascii () {
|
||||||
print="${ascii_color}$(<"$ascii")"
|
print="${ascii_color}$(<"$ascii")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set locale to get correct padding
|
||||||
|
export LC_ALL="en_US.UTF8"
|
||||||
|
|
||||||
# Turn the file into a variable.
|
# Turn the file into a variable.
|
||||||
ascii_strip=$(<"$ascii")
|
ascii_strip=$(<"$ascii")
|
||||||
|
|
||||||
|
@ -1706,20 +1707,23 @@ getascii () {
|
||||||
ascii_strip=${ascii_strip//\\}
|
ascii_strip=${ascii_strip//\\}
|
||||||
|
|
||||||
# Get length of longest line
|
# 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
|
# 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'
|
# Fallback to using awk on systems without 'wc -L'
|
||||||
[ -z "$length" ] && \
|
[ -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
|
# Set the text padding
|
||||||
padding="\033[$((length + gap))C"
|
padding="\033[$((length + gap))C"
|
||||||
|
|
||||||
# Print the ascii
|
# Print the ascii
|
||||||
printf "%b%s" "$print"
|
printf "%b%s" "$print"
|
||||||
|
|
||||||
|
# Set locale to get correct padding
|
||||||
|
export LC_ALL=C
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2459,4 +2463,3 @@ fi
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue