]> sjero.net Git - wget/commitdiff
[svn] Allow almost any character in attribute/tag names.
authorhniksic <devnull@localhost>
Mon, 27 May 2002 15:03:35 +0000 (08:03 -0700)
committerhniksic <devnull@localhost>
Mon, 27 May 2002 15:03:35 +0000 (08:03 -0700)
src/ChangeLog
src/html-parse.c

index 98408664863d1786b64e2f206cd41429ee77314a..f3ba5f0f1ccf502f1fce9835f9fbcfa1ce4d2a86 100644 (file)
@@ -1,3 +1,7 @@
+2002-05-27  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+       * html-parse.c (NAME_CHAR_P): Allow almost any character here.
+
 2002-05-24  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * progress.c (bar_set_params): Fall back to dot progress if the
index 8cdcd692fa2c99b99fa298cf6bf45b415aa83976..74d344400f33c7c6a3e6c584af72408923e922db 100644 (file)
@@ -344,10 +344,23 @@ array_allowed (const char **array, const char *beg, const char *end)
   return 1;
 }
 \f
-/* RFC1866: name [of attribute or tag] consists of letters, digits,
-   periods, or hyphens.  We also allow _, for compatibility with
-   brain-damaged generators.  */
-#define NAME_CHAR_P(x) (ISALNUM (x) || (x) == '.' || (x) == '-' || (x) == '_')
+/* Originally we used to adhere to RFC1866 here, and allowed only
+   letters, digits, periods, and hyphens as names (of tags or
+   attributes).  However, this broke too many pages which used
+   proprietary or strange attributes, e.g.  <img src="a.gif"
+   v:shapes="whatever">.
+
+   So now we allow any character except:
+     * whitespace
+     * 8-bit and control chars
+     * characters that clearly cannot be part of name:
+       '=', '>', '/'.
+
+   This only affects attribute and tag names; attribute values allow
+   an even greater variety of characters.  */
+
+#define NAME_CHAR_P(x) ((x) > 32 && (x) < 127                          \
+                       && (x) != '=' && (x) != '>' && (x) != '/')
 
 /* States while advancing through comments. */
 #define AC_S_DONE      0
@@ -450,10 +463,10 @@ advance_declaration (const char *beg, const char *end)
            }
          break;
        case AC_S_DCLNAME:
-         if (NAME_CHAR_P (ch))
-           ch = *p++;
-         else if (ch == '-')
+         if (ch == '-')
            state = AC_S_DASH1;
+         else if (NAME_CHAR_P (ch))
+           ch = *p++;
          else
            state = AC_S_DEFAULT;
          break;