map "iso-" to "iso" bug

Evgeny Kotsuba evgen at shatura.laser.ru
Sat Jan 8 02:51:14 CET 2005


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