W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2000

Smart quotes cleanup bug

From: Andrzej Novosiolov <anovos@rs-ukraine.kiev.ua>
Date: Fri, 24 Mar 2000 11:47:13 -0600
To: html-tidy@w3.org
Message-ID: <OF6C78E4B0.89AFB4B8-ON8625688D.002E55B4@rfdinc.com>

Module pprint.c, line 409:

if (c > 126 && c < 160)
{
    if (c == 8211)
        c = '-';  /* en dash */
    else if (c == 8212)
        c = '-';  /* em dash */
    else if (c == 8216)
        c = '\'';  /* single left quotation mark */
    else if (c == 8217)
        c = '\'';  /* single right quotation mark */
    else if (c == 8220)
        c = '"';  /* double left quotation mark */
    else if (c == 8221)
        c = '"';  /* double right quotation mark */
}

Obviously, due to enclosing if(), the cleanup code does not work. It must
be:

if (c >= 0x2013 && c <= 0x201E)
{
    switch (c) {
      case 0x2013:
      case 0x2014:
        c = '-';
        break;
      case 0x2018:
      case 0x2019:
      case 0x201A:
        c = '\'';
        break;
      case 0x201C:
      case 0x201D:
      case 0x201E:
        c = '"';
        break;
      }
}

(I also had added two more codes for &bdquo; and &sbquo; cleanup).
Received on Friday, 24 March 2000 13:12:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:43 GMT