Make tests detect UTF-8 locale with a helper executable
This uses the same utility function that mosh-client/mosh-server do. This resolves portability issues with the 'locale' command. This fixes OpenBSD 6.0 and probably Haiku builds.
This commit is contained in:
@@ -60,14 +60,12 @@ chr()
|
||||
set_locale()
|
||||
{
|
||||
# Test for a usable locale.
|
||||
map=$(locale charmap 2>/dev/null)
|
||||
if [ "$map" = "utf-8" ] || [ "$map" = "UTF-8" ]; then
|
||||
if ./is-utf8-locale 2> /dev/null; 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
|
||||
if env LANG=$i ./is-utf8-locale 2> /dev/null; then
|
||||
export LANG=$i LC_ALL=''
|
||||
return 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user