Tk Library Source Code

View Ticket
Login
Ticket UUID: 2028993
Title: ::htmlparse::mapEscapes doesn't handle the ' entity
Type: Bug Version: None
Submitter: skiidoo Created on: 2008-07-26 22:11:12
Subsystem: htmlparse Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2008-07-29 05:22:53
Resolution: Accepted Closed By: andreas_kupries
    Closed on: 2008-07-28 22:22:53
Description:
' is not a valid HTML entity [1] but it is valid in XML [2].

XHTML is supposed to be valid XML, W3C says [3]:
> The named character reference ' (the apostrophe,
> U+0027) was introduced in XML 1.0 but does not appear
> in HTML. Authors should therefore use ' instead of
> ' to work as expected in HTML 4 user agents.

The point here is ' might be used in XHTML pages (not everybody follows W3C advices, this is real world), and anyway ::htmlparse::mapEscapes might be used on XML trees, so I think it should handle ' as well.

How to reproduce:
Use ::htmlparse::mapEscapes on a string containing '''.

Actual result:
  % package require htmlparse
  1.1.2
  %  ::htmlparse::mapEscapes { J.D. 'Boss' Hogg }
   J.D. 'Boss' Hogg

Expected result:
Map the ' entity to an apostrophe:
  %  ::htmlparse::mapEscapes { J.D. 'Boss' Hogg }
   J.D. 'Boss' Hogg

[1] http://www.w3.org/TR/html4/sgml/entities.html
[2] http://www.w3.org/TR/REC-xml/
[3] http://www.w3.org/TR/xhtml1/#C_16
User Comments: andreas_kupries added on 2008-07-29 05:22:53:
Logged In: YES 
user_id=75003
Originator: NO

Accepted the reasoning, extended set of named entities with apos.
Committed to CVS head.
This is now version 1.1.3.