juz to robilem, wlasnie z tego wiem ze mam zmienic encoding na utf-8. I jeszcze kodowanie pliku geshi na utf-8 (jesli tego nie zrobilem mialem 3 dziwne znaki).
Ale już wiem gdzie jest ,,error"i. O to kod:
<?php
include_once('geshi.php');
$source = '<php><br /><?php<br /> if (file_exists(\'liczniki/pliczek.exe.txt\'))<br /> readfile(\'liczniki/pliczek.exe.txt\');<br /> else echo(\'0\');//jeśli brak ściągnięć to dajemy na 0<br />?></php>';
function nowewersy($phpz)
{
$phpz=str_replace('<br />',chr(13),$phpz);
return $phpz;
}
$pattern = '/<php>(.+?)<\/php>/s';
function koloruj($in){
$geshi =& new GeSHi(nowewersy(html_entity_decode($in[1])), 'php');
return $geshi->parse_code();
}
echo preg_replace_callback($pattern, 'koloruj', $source);
?>
// He, he, skąd ja pamiętam tę funkcję :) - Cold
Jak wykonacie to gratis dostaniecie ????? (zapytajniki). Chodziło o 1 rzecz html_entity_decode. ona jest dla iso. Wiec zamieniłem ta funkcje na
function html_entity_decode_utf8($string)
{
static $trans_tbl;
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'code2utf(hexdec("\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'code2utf(\\1)', $string);
// replace literal entities
if (!isset($trans_tbl))
{
$trans_tbl = array();
foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key)
$trans_tbl[$key] = utf8_encode($val);
}
return strtr($string, $trans_tbl);
}
// Returns the utf string corresponding to the unicode value (from php.net, courtesy - [email protected])
function code2utf($num)
{
if ($num < 128) return chr($num);
if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
if ($num < 65536) return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
if ($num < 2097152) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
return '';
}
1 rzecz 5 godzin w plecy :9
Więc mozna usunąć temat - lub pozostawic potomnych