Date: Wed, 10 Jul 2002 23:50:03 -0700 (PDT) From: Gennady Proskurin <gpr@nvnpp.vrn.ru> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/35812: strings(1) does'n print russian characters Message-ID: <200207110650.g6B6o366040340@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/35812; it has been noted by GNATS. From: Gennady Proskurin <gpr@nvnpp.vrn.ru> To: Jonathan Chen <jon@FreeBSD.org> Cc: freebsd-gnats-submit@FreeBSD.org, "."@babolo.ru Subject: Re: bin/35812: strings(1) does'n print russian characters Date: Thu, 11 Jul 2002 10:37:28 +0400 Hello, Jonathan. On Sun, Jul 07, 2002 at 12:50:06PM -0400, Jonathan Chen wrote: > > Gennady Proskurin writes: > > [...] > - putchar((char)ch); > + putchar((unsigned char)ch); > > I do not believe the type-casting is necessary, since putchar() takes an > int. Casting to unsigned char (or just char for that matter) would break > wchar too. Please try replacing putchar(...) with simply putchar(ch) and > let me know if that works. > > > "."@babolo.ru writes: > [...] > - if (ISSTR(ch)) { > + if (ISSTR(ch) & 0xff) { > [...] > - while ((ch = getch()) != EOF && ISSTR(ch)) > + while ((ch = getch()) != EOF && ISSTR(ch & 0xff > > The first diff here appears to be wrong, you probably meant (ch & 0xff) > instead of what you have. Nevertheless, I don't think either of these > changes are necessary, since all the functions in ISSTR are able to take > integers as well. > > Please try strings with only the typecast removal change. Let me know of > this works, and I'll commit it. If not, something else is probably > broken... This patches are for /usr/libexec/aout/strings, which works fine with locale without any patches ;). Sorry for false alarm :( /usr/libexec/elf/strings manpage says that it prints "printable" chars, but in fact it prints chars that printable only in C locale, because it uses libiberty for detect printable chars, and isprint macro from libiberty is documented as locale-independent. I think it should be mentioned in elf/strings manpage that it doesn't depend on locale to not confuse users. > > -Jon > -- Gennady To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207110650.g6B6o366040340>