Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Oct 2023 07:56:45 GMT
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 9fee35128080 - main - dialog: force UTF-8 locale
Message-ID:  <202310110756.39B7ujSn036374@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9fee35128080f036c7b318cbbe20067ccca409db

commit 9fee35128080f036c7b318cbbe20067ccca409db
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2023-10-11 07:54:12 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2023-10-11 07:56:27 +0000

    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
---
 Mk/Scripts/dialog4ports.sh |  4 ++--
 Mk/bsd.licenses.mk         | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Mk/Scripts/dialog4ports.sh b/Mk/Scripts/dialog4ports.sh
index de62a91b583f..ba8dbb7cd48d 100644
--- a/Mk/Scripts/dialog4ports.sh
+++ b/Mk/Scripts/dialog4ports.sh
@@ -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
diff --git a/Mk/bsd.licenses.mk b/Mk/bsd.licenses.mk
index f9332996207b..cc3b8f29f478 100644
--- a/Mk/bsd.licenses.mk
+++ b/Mk/bsd.licenses.mk
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202310110756.39B7ujSn036374>