Re: 1.9.2, solaris9, locale, question marks instead of accented letters
Urs Janßen <[email protected]> Sat, 28 Jul 2007 15:04:36 +0200
| Newsgroups | gmane.network.tin.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jul 27, 2007 at 03:34:19AM +0200, Piotr KUCHARSKI wrote:
> Hello,
>
> I traced the bug to this: with undefined NO_LOCALE (as I want to use
> locale) on Solaris 9 langinfo(CODESET) returns ISO8859-2 for Polish
> language (ISO8859-1 for German etc.), which does not match ISO-8859-2
> setting of mm_network_charset, which in turn makes tin print '?' instead
> of all those nice accented letters.
>
> The following patch fixed it for me:
>
> diff -ur tin-1.9.2.org/src/config.c tin-1.9.2/src/config.c
> --- tin-1.9.2.org/src/config.c Fri Dec 22 02:41:54 2006
> +++ tin-1.9.2/src/config.c Fri Jul 27 03:09:39 2007
> @@ -815,6 +815,8 @@
> if ((p = tin_nl_langinfo(CODESET)) != NULL) {
> if (!strcmp(p, "ANSI_X3.4-1968"))
> strcpy(tinrc.mm_local_charset, "US-ASCII");
> + else if (!strncmp(p, "ISO8859-", 8))
> + sprintf(tinrc.mm_local_charset, "ISO-8859-%s", p+8);
> else
> strcpy(tinrc.mm_local_charset, p);
> } else
>
mm_local_charset is used in iconv(3) calls and the systems iconv may not
know the rewritten charset-name (and other OS may return other combinations,
i.e. HP-UX return "iso8859x" without any '-' , so rewriting is a bad idea.
Without looking at the code I'd say that a correct way to fix this is to
remove all '-' from the charset-name every time before doing a _caseless_
stringcompare whenever the charset name is checked (IIRC in post.c), but
keep the nl_langinfo(CODESET) returnval in tinrc.mm_local_charset (-> ensure
we use iconv_open(whatever, nl_langinfo(CODESET))).