Ignore:
Timestamp:
02/13/05 07:44:00 (15 years ago)
Author:
gogo
Message:

Fixes to allow unicode more cleanly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/SuperClean/tidy.php

    r1 r7  
    2626    } 
    2727  } 
     28 
     29  header('Content-Type: text/javascript; charset=utf-8'); 
    2830 
    2931  /** Function to POST some data to a URL */ 
     
    99101  if(trim(@$_REQUEST['content'])) 
    100102  { 
     103    // PHP's urldecode doesn't understand %uHHHH for unicode 
     104    $_REQUEST['content'] = preg_replace('/%u([a-f0-9]{4,4})/ei', 'utf8_chr(0x$1)', $_REQUEST['content']); 
     105    function utf8_chr($num) 
     106    { 
     107      if($num<128)return chr($num); 
     108      if($num<1024)return chr(($num>>6)+192).chr(($num&63)+128); 
     109      if($num<32768)return chr(($num>>12)+224).chr((($num>>6)&63)+128).chr(($num&63)+128); 
     110      if($num<2097152)return chr(($num>>18)+240).chr((($num>>12)&63)+128).chr((($num>>6)&63)+128) .chr(($num&63)+128); 
     111      return ''; 
     112    } 
    101113    ob_start(); 
    102       passthru("echo " .  escapeshellarg($_REQUEST['content']) . " | tidy -q -i -wrap 9999 2>/dev/null", $result); 
     114      passthru("echo " .  escapeshellarg($_REQUEST['content']) . " | tidy -q -i -u -wrap 9999 -utf8 -bare -asxhtml 2>/dev/null", $result); 
    103115      $content = ob_get_contents(); 
    104116    ob_end_clean(); 
Note: See TracChangeset for help on using the changeset viewer.