From 118c8f4699ece9197dc9f43f09a29e309d6aca39 Mon Sep 17 00:00:00 2001 From: Tanya Degurechaff <34323200+TanyaEleventhGoddess@users.noreply.github.com> Date: Mon, 6 Jul 2020 10:44:57 +0200 Subject: [PATCH] Handle languages that are only UTF-8 encoded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Pierre-Elliott Bécue Signed-off-by: Tanya Degurechaff <34323200+TanyaEleventhGoddess@users.noreply.github.com> --- templates/lxc-debian.in | 3 ++- templates/lxc-kali.in | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in index 49073b0..5769b39 100644 --- a/templates/lxc-debian.in +++ b/templates/lxc-debian.in @@ -143,7 +143,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=$(locale charmap) + [ -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 diff --git a/templates/lxc-kali.in b/templates/lxc-kali.in index ef8cd01..0aca315 100755 --- a/templates/lxc-kali.in +++ b/templates/lxc-kali.in @@ -144,7 +144,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=$(locale charmap) + [ -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