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: Tue, 22 Feb 2000 10:24:56 +0200
Message-Id: <200002220825.KJR43518@zirafe.carrier.kiev.ua>
To: html-tidy@w3.org
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 Tuesday, 22 February 2000 03:25:17 GMT

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