Ensure a UTF-8 locale is available for tests
Fixes Debian sid schroot build. Also add build deps required for full testing: tmux, less (for window-resize.test)
This commit is contained in:
@@ -54,3 +54,24 @@ chr()
|
||||
{
|
||||
printf '%b' "\\0$(printf %03o "$1")"
|
||||
}
|
||||
|
||||
# If the locale is not set to a UTF-8 locale, set it to en_US.UTF-8
|
||||
# or C.UTF-8.
|
||||
set_locale()
|
||||
{
|
||||
# Test for a usable locale.
|
||||
map=$(locale charmap 2>/dev/null)
|
||||
if [ "$map" = "utf-8" ] || [ "$map" = "UTF-8" ]; then
|
||||
return 0
|
||||
fi
|
||||
# Attempt to find/set a usable locale.
|
||||
for i in en_US.UTF-8 en_US.utf8 C.UTF-8; do
|
||||
map="$(env LANG=$i locale charmap 2>/dev/null)"
|
||||
if [ "$map" = "utf-8" ] || [ "$map" = "UTF-8" ]; then
|
||||
export LANG=$i LC_ALL=''
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
# Fail.
|
||||
return 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user