[lxc-devel] [lxd-pkg-snap/latest-edge] Fix Unicode character compatibility in `lxc config edit`

Lin-Buo-Ren on Github lxc-bot at linuxcontainers.org
Fri Dec 21 14:48:57 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 941 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181221/33c619c2/attachment.bin>
-------------- next part --------------
From 4c1c29c70e034849357173d6f2d6d308397adb53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=2C=20Lin=29?=
 <Buo.Ren.Lin at gmail.com>
Date: Fri, 21 Dec 2018 22:34:59 +0800
Subject: [PATCH] Fix Unicode character compatibility in `lxc config edit`
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently Unicode characters will become garbled when editing container
configs due to the unsupported user locale settings.  This patch fixes
the problem by resetting the locales to `C.UTF-8`.

Note that this is not a complete fix as it also disables the L10N as the
locales are hardcoded, the `locales-launch` remote part[1] is a solution
for this problem.

Fixes #29.

[1] https://forum.snapcraft.io/t/the-locales-launch-remote-part/8729

Signed-off-by: ๆž—ๅšไป(Buo-ren, Lin) <Buo.Ren.Lin at gmail.com>
---
 snapcraft/commands/lxc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/snapcraft/commands/lxc b/snapcraft/commands/lxc
index 88e1677..15380e8 100755
--- a/snapcraft/commands/lxc
+++ b/snapcraft/commands/lxc
@@ -33,6 +33,10 @@ if [ "${EDITOR:-}" != "nano" ]; then
 fi
 export VISUAL=${EDITOR:-}
 
+# Reset all locales as it isn't available in the snap (#5375)
+LANG=C.UTF-8
+export LC_ALL=C.UTF-8
+
 LXC="lxc"
 if [ -x "${SNAP_COMMON}/lxc.debug" ]; then
     LXC="${SNAP_COMMON}/lxc.debug"


More information about the lxc-devel mailing list