All pastes #18731 Raw Edit

Miscellany

public text v1 · immutable
#18731 ·published 2005-07-28 19:58 UTC
rendered paste body
    // do character encoding translations.
    $charsets = array('utf-8', 'latin1', 'windows-1251', 'windows-1252');
    $converts = array('headline', 'synopsis', 'transcript', 'tease');
    foreach ($converts as $convert) { // make sure they're not already.
      foreach ($charsets as $charset) {
        if ($converted = iconv($charset, 'utf-8//TRANSLIT', $pg_row[$convert])) {
          $pg_row[$convert] = $converted; break; // yummy utf-8. yay!
        }
      }
    }