rss encoding...


rss encoding...

18.01.2002, 11:00 · Martin · Permalink

is my last real deal-stopper for SBELT2. encoding Umlauts etc. as html-entities won't do... [update!] the rss url should work now!!! For the brave and curious out there: here's the URL: traumwind-rss One step further. It is possible to turn around the encoding-table PHP uses to get custom bahavior:

<?
$html = "<this> is not a tag, ÜÄÄÄhh";
function changeencoding (&$item1, $key) {
    $item1 = "&#".Ord($key).";";
}
function xmlencode ($s) {
    if (empty($xmltrans)) { // do this only once
        $xmltrans = get_html_translation_table(HTML_ENTITIES);
        array_walk ($xmltrans, 'changeencoding');
        reset ($xmltrans);
    }
    return strtr($s, $xmltrans);
}

$xmlsafe = xmlencode($html);
echo $xmlsafe;
?>

produces:
&#60;this&#62; is not a tag, &#220;&#196;&#196;&#196;hh
which I reall think is much nicer ;)

ähnliche Einträge:


alles Bild, Text und Tonmaterial ist © Martin Spernau, Verwendung und Reproduktion erfordert die Zustimmung des Authors

Martin Spernau
© 1994-2026


amazon.de Wunschliste

Facebook me!
Google+

powered by Traumtank