map "iso-" to "iso" bug

David Relson relson at osagesoftware.com
Sat Jan 8 05:07:27 CET 2005


Evgeny,

I'm working on code to use iconv() rather than bogofilter's charsets and
maps.  It's still experimental and I don't expect any time tomorrow to
work on it.  If you're interested, I may be able to send you a copy Sunday.

Also, I'll not have a chance to check on your "iso-" / "iso" patch
before then.

David


On Sat, 08 Jan 2005 04:51:14 +0300
Evgeny Kotsuba wrote:

> Hi,
> 
> I am catching asian spam at night and looking at
> void set_charset(const char *charset)
> {
> .....
>     if (c == '-' &&         /* map "iso-" to "iso"     */
>             memcmp(t, "iso", 3) == 0)
>             continue;
> 
> 
> With charset="iso-2022-jp"  it is mapped to "iso2022jp"  that  is not right
> The patch for it may look like following, but I am not sure at  tooonight
> 
> @@ -514,16 +519,17 @@
>  {
>      char *t = (char *) charset;
>      char *s, *d;
> +    int i;
>      bool q = *t == '"';
> 
>      t = xstrdup( t + q);
> 
> -    for (s = d = t; *s != '\0'; s++)
> +    for (i=0,s = d = t; *s != '\0'; s++, i++)
>      {
>         char c = tolower(*s);   /* map upper case to lower */
>         if (c == '_')           /* map underscore to dash */
>             c = '-';
> -       if (c == '-' &&         /* map "iso-" to "iso"     */
> +        if (c == '-' && i == 3 &&        /* map "iso-" to "iso"     */
>             memcmp(t, "iso", 3) == 0)
>             continue;
>         if (q && c == '"')
> 
> 
> SY,
> EK



More information about the bogofilter-dev mailing list