[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling invalid HTML

From: Juri Linkov
Subject: Re: Handling invalid HTML
Date: Wed, 19 Oct 2005 18:59:14 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2
>     "By default, SGML requires that all attribute values be delimited
>     using either double quotation marks (ASCII decimal 34) or single
>     quotation marks (ASCII decimal 39). ... In certain cases, authors
>     may specify the value of an attribute without any quotation marks."
> In XHTML the no-marks case was eliminated, but the use of 'apostrophes' 
> is still valid.  There are many complaints one can make about 
> Microsoft, but this isn't one of them.

I still see no reason for them to generate HTML files with such an
uncommon syntax, if not for making the life of users harder.

Anyway, the following patch will allow Emacs to recognize encoding
with either quotation marks (and for the attribute `content-type'
quotation marks are optional):

Index: lisp/international/mule.el
RCS file: /cvsroot/emacs/emacs/lisp/international/mule.el,v
retrieving revision 1.226
diff -c -r1.226 mule.el
*** lisp/international/mule.el  24 Sep 2005 13:43:59 -0000      1.226
--- lisp/international/mule.el  19 Oct 2005 15:57:28 -0000
*** 2229,2242 ****
                    (forward-line 10)
!   (when (and (search-forward "<html" size t)
!            (re-search-forward 
 size t))
!       (let* ((match (match-string 1))
!            (sym (intern (downcase match))))
!       (if (coding-system-p sym)
!           sym
!         (message "Warning: unknown coding system \"%s\"" match)
!         nil))))
  (provide 'mule)
--- 2233,2245 ----
                    (forward-line 10)
!   (when (re-search-forward 
 size t)
!     (let* ((match (match-string 1))
!          (sym (intern (downcase match))))
!       (if (coding-system-p sym)
!         sym
!       (message "Warning: unknown coding system \"%s\"" match)
!       nil))))
  (provide 'mule)

Juri Linkov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]