[f13-branch] loader: con Newt into thinking LANG is always en_US.UTF-8 (#576541).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 loader/loader.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index 2b2094a..8d47f1e 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -125,6 +125,7 @@ int post_link_sleep = 0;
 
 static pid_t init_pid = 1;
 static int init_sig = SIGUSR1; /* default to shutdown=halt */
+static const char *LANG_DEFAULT = "en_US.UTF-8";
 
 static struct installMethod installMethods[] = {
     { N_("Local CD/DVD"), 0, DEVICE_CDROM, mountCdromImage },
@@ -220,10 +221,20 @@ void startNewt(void) {
     if (!newtRunning) {
         char *buf;
         char *arch = getProductArch();
-
         checked_asprintf(&buf, _("Welcome to %s for %s"), getProductName(), arch);
 
+        /*
+         * Because currently initrd.img only has got the default English locale
+         * support, pretend for newtInit() it is actually the used LANG so Newt
+         * knows how to compute character widths etc. 
+         **/
+        char *lang = strdup(getenv("LANG"));
+        setenv("LANG", LANG_DEFAULT, 1);
         newtInit();
+        /* restore the original LANG value */
+        setenv("LANG", lang, 1);
+        free(lang);
+
         newtCls();
         newtDrawRootText(0, 0, buf);
         free(buf);
@@ -319,7 +330,7 @@ char * getProductPath(void) {
 
 void initializeConsole() {
     /* enable UTF-8 console */
-    setenv("LANG","en_US.UTF-8",1);
+    setenv("LANG", LANG_DEFAULT, 1);
     printf("\033%%G");
     fflush(stdout);
 
-- 
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux