NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: install/39193: sysinst lost umlauts
The following reply was made to PR install/39193; it has been noted by GNATS.
From: "Takehiko NOZAKI" <takehiko.nozaki%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: install/39193: sysinst lost umlauts
Date: Mon, 28 Jul 2008 18:56:20 +0900
> It is a sign extension problem: a-umlaut is 0xe4, calling
> wcwidth(0x000000e4)
> returns 1, but when choosing the german sysinst translaton it is called
> with 0xffffffe4 and returns 0.
hmmm, libhack's version's
mbrtowc/wcrtomb(src/distrib/utils/libhack/multibyte.c)
seems directlty cast char -> wchar_t, i think this is wrong...
Index: multibyte.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/libhack/multibyte.c,v
retrieving revision 1.3
diff -u -r1.3 multibyte.c
--- multibyte.c 12 Jul 2008 19:20:03 -0000 1.3
+++ multibyte.c 28 Jul 2008 09:48:32 -0000
@@ -11,13 +11,13 @@
size_t
mbrtowc(wchar_t *wc, const char *str, size_t max_sz, mbstate_t *ps)
{
- return str == NULL || (*wc = *str) == 0 ? 0 : 1;
+ return str == NULL || (*wc = (unsigned char)*str) == 0 ? 0 : 1;
}
size_t
wcrtomb(char *str, wchar_t wc, mbstate_t *ps)
{
- *str = wc;
+ *str = wc & 0xFF;
return 1;
}
> I verified that this is unrelated to libhack and the restricted locale
> support - it also happens in a debug build of sysinst with full dynamic
> libc and locale support.
sysinst(8) should have to call setlocale(3) in full dynmic libc and
locale support, i think.
Index: main.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/main.c,v
retrieving revision 1.52
diff -u -r1.52 main.c
--- main.c 23 Oct 2006 19:45:56 -0000 1.52
+++ main.c 28 Jul 2008 09:54:11 -0000
@@ -47,6 +47,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
+#include <locale.h>
#include "defs.h"
#include "md.h"
@@ -136,6 +137,7 @@
#endif
scripting = 0;
+ setlocale(LC_ALL, "");
/* Check for TERM ... */
if (!getenv("TERM")) {
(void)fprintf(stderr,
previous version of src/libcurses/acs.c call setlocale(3) internally,
but that is bug.
so i removed rev1.16.
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libcurses/acs.c.diff?r1=1.15&r2=1.16
very truly yours.
--
Takehiko NOZAKI<takehiko.nozaki%gmail.com@localhost>
Home |
Main Index |
Thread Index |
Old Index