[lxc-devel] [lxc-templates/master] [lxc-debian] Handle languages that are only UTF-8 encoded

P-EB on Github lxc-bot at linuxcontainers.org
Fri Mar 20 10:44:05 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 319 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200320/8c4e8806/attachment.bin>
-------------- next part --------------
From 7e47ba0a00083426befa03564da4920c806c8c4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= <becue at crans.org>
Date: Fri, 20 Mar 2020 11:43:02 +0100
Subject: [PATCH] [lxc-debian] Handle languages that are only UTF-8 encoded

---
 templates/lxc-debian.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index fd26d5e..efc1ead 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -129,7 +129,8 @@ EOF
         chroot "$rootfs" locale-gen en_US.UTF-8 UTF-8
         chroot "$rootfs" update-locale LANG=en_US.UTF-8
     else
-        encoding=$(echo "$LANG" | cut -d. -f2)
+        encoding=$(echo "$LANG" | cut -d. -f2 -s)
+        [ -z "${encoding}" ] && encoding="UTF-8"
         chroot "$rootfs" sed -e "s/^# \(${LANG} ${encoding}\)/\1/" \
             -i /etc/locale.gen 2> /dev/null
         cat >> "$rootfs/etc/locale.gen" << EOF


More information about the lxc-devel mailing list