Public feed #725913

btully

public php v1 · immutable
Raw Edit
·published 2007-10-04 19:34 UTC
rendered paste body
<?php// converts evil Microsoft "SMART QUOTES" and other // evil characters inserted by Word/Excelfunction article_cleanup_ms_decode($text) {      $badchr = array(        "\xe2\x80\xa6",       // ellipsis        "\xe2\x80\x93",       // long dash        "\xe2\x80\x94",       // long dash        "\xe2\x80\x98",       // single quote opening        "\xe2\x80\x99",       // single quote closing        "\xe2\x80\x9c",       // double quote opening        "\xe2\x80\x9d",       // double quote closing        "%u201C",             // double quote opening        "%u201D",             // double quote closing        "%u201B",             // single quote opening        "%u2018",             // single quote closing        "%u2019",             // apostrophe        "\xe2\x80\xa2",       // dot used for bullet points        "%u00C2",             // weird A circumflex        "%u00A9",             // copyright        "©"                   // copyright        );        $goodchr = array(        '...',        '-',        '-',        '\'',        '\'',        '"',        '"',        '"',        '"',        '\'',        '\'',        '\'',        '*',        '',        '&copy;',        '&copy;'        );    $text = str_replace($badchr, $goodchr, $text);    return $text;}?>