dialog: force UTF-8 locale

On some terminal, namely "putty" and "linux", the unicode capability
are not properly exposed, resulting in a not so nice UI, forcing
the env to be unicode friendly with executing the DIDALOG commnands
make the output nice in those environements
This commit is contained in:
Baptiste Daroussin 2023-10-11 09:54:12 +02:00
parent 27b1250d59
commit 9fee351280
2 changed files with 7 additions and 7 deletions

View file

@ -42,9 +42,9 @@ fi
# Clear environment of PKGNAME or the dialog will show on older versions
# that do not understand -v.
if ! env -u PKGNAME ${DIALOG4PORTS} -v > /dev/null 2>&1; then
exec $DIALOG4PORTS > $OPTIONSFILE 2>&1
exec env LC_ALL=C.UTF-8 $DIALOG4PORTS > $OPTIONSFILE 2>&1
fi
# Newer versions use stderr to work around a jail issue
# http://lists.freebsd.org/pipermail/freebsd-ports/2013-March/082383.html
exec $DIALOG4PORTS 2> $OPTIONSFILE
exec env LC_ALL=C.UTF-8 $DIALOG4PORTS 2> $OPTIONSFILE

View file

@ -645,7 +645,7 @@ ${_LICENSE_COOKIE}:
. if !defined(NO_LICENSES_DIALOGS)
# Dialog interface
. if ${_LICENSE_COMB} == "single"
@${DIALOG} --title "License for ${PKGNAME} (${_LICENSE})" \
@${SETENV} LC_ALL=C.UTF-8 ${DIALOG} --title "License for ${PKGNAME} (${_LICENSE})" \
--yes-label Accept --no-label Reject --yesno \
"$$(${CAT} ${_LICENSE_FILE})" 21 76
@ -662,13 +662,13 @@ ${_LICENSE_COOKIE}:
done; \
menu_cmd="$${menu_cmd} REJECT \"Reject the licenses (all)\""; \
while true; do \
${SH} -c "$${menu_cmd} 2>\"$${tmpfile}\""; \
${SH} -c "${SETENV} LC_ALL=C.UTF-8 $${menu_cmd} 2>\"$${tmpfile}\""; \
result=$$(${CAT} "$${tmpfile}"); \
case $${result} in \
REJECT) exit 1;; \
VIEW_*) name=$$(${ECHO_CMD} $${result} | ${SED} -e 's/^VIEW_//'); \
file=$$(${GREP} "^$${name}:" ${_LICENSE_ASK_DATA} | ${CUT} -d : -f 2); \
${DIALOG} --textbox "$${file}" 21 75 ;; \
${SETENV} LC_ALL=C.UTF-8 ${DIALOG} --textbox "$${file}" 21 75 ;; \
USE_*) name=$$(${ECHO_CMD} $${result} | ${SED} -e 's/^USE_//'); \
${ECHO_CMD} $${name} > ${_LICENSE_COOKIE}; \
break ;; \
@ -680,7 +680,7 @@ ${_LICENSE_COOKIE}:
. for lic in ${_LICENSE_TO_ASK}
@${ECHO_CMD} "${lic}:${_LICENSE_FILE_${lic}}" >> ${_LICENSE_ASK_DATA}
. endfor
@menu_cmd="${DIALOG} --hline \"This port requires you to accept all mentioned licenses\" --menu \"License for ${PKGNAME} (multi)\" 21 70 15"; \
@menu_cmd="${SETENV} LC_ALL=C.UTF-8 ${DIALOG} --hline \"This port requires you to accept all mentioned licenses\" --menu \"License for ${PKGNAME} (multi)\" 21 70 15"; \
trap '${RM} $$tmpfile' EXIT INT TERM; \
tmpfile=$$(mktemp -t portlicenses); \
for lic in ${_LICENSE_TO_ASK}; do \
@ -695,7 +695,7 @@ ${_LICENSE_COOKIE}:
REJECT) exit 1 ;; \
VIEW_*) name=$$(${ECHO_CMD} $${result} | ${SED} -e 's/^VIEW_//'); \
file=$$(${GREP} "^$${name}:" ${_LICENSE_ASK_DATA} | ${CUT} -d : -f 2); \
${DIALOG} --textbox "$${file}" 21 75 ;; \
${SETENV} LC_ALL=C.UTF-8 ${DIALOG} --textbox "$${file}" 21 75 ;; \
esac; \
done
. endif