nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] test/pick/test-pick failing on FreeBSD

2013-01-31 13:39:59
The 'pick -subject foobar 13' test is failing on FreeBSD (9.1 and
-CURRENT). I don't have any time to chase this one, so this is just a
heads up. Scan says:

  1+ 09/29 Test13 foo =?utf-8?q?=62=61=72?=<<This is message numbe

I am wondering ... maybe the issue is that autoconf isn't detecting iconv
support?

I see this in fmt_rfc2047.c:

            /* Check if character set can be handled natively */
            if (!check_charset(startofmime, pp - startofmime)) {
#ifdef HAVE_ICONV
                /* .. it can't. We'll use iconv then. */
                *pp = '\0';
                cd = iconv_open(get_charset(), startofmime);
                fromutf8 = !mh_strcasecmp(startofmime, "UTF-8");
                *pp = '?';
                if (cd == (iconv_t)-1) continue;
                use_iconv = 1;
#else
                continue;
#endif
            }

So if you're (a) not using a UTF-8 locale and (b) don't have iconv support,
it will not decode anything.  The same thing happens if you try to use an
unknown charset, even with iconv support:

% ap -format '%(decode{text})' '=?random?q?foobar?='
=?random?q?foobar?=

Assuming FreeBSD doesn't ship with iconv and not finding it isn't an
autoconf problem, perhaps the right solution is to simply run this test
in a UTF-8 locale so it will always decode the second token (US-ASCII
is handled internally, so it will always work).  So in test/pick/test-pick,
you'd do:

LC_CTYPE=en_US.UTF-8 pick -subject foobar 13 >"$actual" 2>&1

Robert Elz writes:
I know that it should display as "foobar" - the RFC is kind of weird, it
says "for display purposes" (or similar) in several places, which implies
that for other purposes the words are not considered as one.

I think that the RFC authors were talking about how those messages are
parsed, and my personal interpretation is that by "display" they mean
"how you present this to the user", which would also includes when a user
is searching for particular headers.

--Ken

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>