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

Re: Droping 1200kB boot floppies - who minds?



#include <hallo.h>
Philip Blundell wrote on Mon Feb 25, 2002 um 08:29:47PM:

> I haven't had a chance to test this yet but I think it should be
> somewhere near right.  Setting LANG=C@utf-8 may not be necessary

It is not necessary, and it even hurts. I tries different locale
settings. Summary:

 - to not break non-ASCII chars, LANG must be either C or a valid
   xx_YY.UTF-8 locale
 - LC_CTYPE must be a valid locale string (or I am misguided by the
   whiptail bug, see below)
 - LC_MESSAGES is used by modconf. It should contain a _, . and .UTF-8

> If we had more confidence in our convictions, we could just set
> LC_MESSAGES in main.c and forget about it thereafter.  I haven't done
> this just in case some other program that gets called is not yet
> i18n-tolerant.

Yup. I attached the modified version, it does set all tree values.
Though there is a problem with whiptail-utf8:

$ ldd /usr/bin/whiptail | grep newt
        libnewt.so.0.50 => /usr/lib/libnewt.so.0.50 (0x40028000)

Junichi, could you fix this?

Gruss/Regards,
Eduard.
-- 
Wer Freiheit aufgibt, um Sicherheit zu bekommen, verdient keins der
beiden und bekommt meist auch keins.
                                         -- Benjamin Franklin, 1759
Index: baseconfig.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/baseconfig.c,v
retrieving revision 1.104
diff -u -r1.104 baseconfig.c
--- baseconfig.c	2002/02/25 08:47:07	1.104
+++ baseconfig.c	2002/02/25 21:40:03
@@ -528,7 +528,7 @@
   char buffer1[PATH_MAX];
   char buffer2[PATH_MAX];
 #endif
-  char *old_locale;
+  char *old_locale, *old_lc_messages, *old_lc_ctype, *p;
 
   if (! NAME_ISEXE("/usr/bin/whiptail", &statbuf))
       symlink("/target/usr/bin/whiptail", "/usr/bin/whiptail");
@@ -575,11 +575,20 @@
      will work.  See bug #78750 */
   execlog("echo /sbin/modprobe >/proc/sys/kernel/modprobe", LOG_INFO);
 
-  /* Modconf needs the correct LANG or LC_MESSAGES string (test later). If it
-   * does not, fix this later, also see below
-
-  old_locale = getenv("LC_ALL");
-  setenv("LC_ALL", "C", 1); */
+#ifdef USE_LANGUAGE_CHOOSER
+  old_locale = getenv("LANG");
+  old_lc_messages = getenv("LC_MESSAGES");
+  old_lc_messages = getenv("LC_CTYPE");
+
+  strcpy(prtbuf, lang->locale);
+  p = strchr(prtbuf, '.');
+  if (p)
+    strcpy(p+1, "UTF-8");
+
+  setenv("LANG", prtbuf, 1);
+  setenv("LC_MESSAGES", prtbuf, 1);
+  setenv("LC_CTYPE", prtbuf, 1);
+#endif
   
   /* copy the preconfigured modules file to target/etc */
   execlog("test -f /target/etc/modules || cp /etc/modules /target/etc/", LOG_INFO);
@@ -595,11 +604,21 @@
   /* Turn kmod off again */
   execlog("echo /bin/true >/proc/sys/kernel/modprobe", LOG_INFO);
 
-  /* Restore the old locale
+#ifdef USE_LANGUAGE_CHOOSER
+  /* Restore the old locale */
   if (old_locale)
-    setenv("LC_ALL", old_locale, 1);
+    setenv("LANG", old_locale, 1);
+  else
+    unsetenv("LANG");
+  if (old_lc_messages)
+    setenv("LC_MESSAGES", old_lc_messages, 1);
   else
-    unsetenv("LC_ALL"); */
+    unsetenv("LC_MESSAGES");
+  if (old_lc_ctype)
+    setenv("LC_CTYPE", old_lc_ctype, 1);
+  else
+    unsetenv("LC_CTYPE");
+#endif
 
   update_cdrom_symlink();
 

Reply to: