Comment 1 for bug 1752362

Revision history for this message
Eric Desrochers (slashd) wrote :

Using root shell, I can reproduce the problem using the command line (not only reproducible in the dialog window)

Here's the system variable right after booting in Recovery mode took from the root shell option.

---
$ echo $LANG
zh_CN.UTF-8

$ echo $LANGUAGE
zh_CN:zh
---

If I change manually the system variables as follow :

--
export LANG=C.UTF-8
export LANGUAGE=en
---

The situation disappear.

friendly-recovery have a blacklist including a detection for "zh_" mechanism but doesn't seems to default $LANG and $LANGUAGE to good working console value to avoid this situation to happen with CJK font.

I have tested the following approach and it works by displaying in english when detect a known font which have not a good console output.

--
# blacklist some languages that we don't have a good console fonts for
# see bug #573502
in_lang_blacklist() {
    LANG_BLACKLIST="ar_ he_IL ja_JP ko_KR ru_RU sl_SI vi_VN zh_"
    LANG=$1
    for b in $LANG_BLACKLIST; do
        # equal to lang.startswith(b)
        if expr match "$LANG" ^"$b" >/dev/null ; then
+ export LANG=C.UTF-8
+ export LANGUAGE=en
            return 0
        fi
    done
    return 1
}

# There is no environment set, as these steps are skipped,
# so we need to source the variables needed for localization ourselves
if [ -r /etc/default/locale ]; then
 . /etc/default/locale
 if ! in_lang_blacklist "$LANG"; then
     export LANG LANGUAGE
 fi
elif [ -r /etc/environment ]; then
 . /etc/environment
 if ! in_lang_blacklist "$LANG"; then
     export LANG LANGUAGE
 fi
fi

. gettext.sh
export TEXTDOMAIN=friendly-recovery
export TEXTDOMAINDIR=/usr/share/locale
---