Reply to trying to make characters safe for my RSS feed

Your name:

Reply:


Posted by lkrubner on 10/11/05 01:09

Whenever users write a post in Microsoft Word and then post it to
their weblogs using my PHP software, their RSS feed ends up being
corrupted with garbage characters which violate the well-formedness of
their XML and therefore cause their newsreaders to die.

This function will probably make the character strings completely safe
for XML? I don't care about having garbage characters in the RSS feed,
I just want the RSS feed to show up, without causing anyone's newsfeed
reader to die.


function command($string=false) {
$howMany = strlen($string);

$newString = "";
for ($i=0; $i < $howMany; $i++) {
$char = $string[$i];
$asciiNum = ord($char);
if ($asciiNum > 32 && $asciiNum < 128) {
$newString .= $char;
} else {
$newString .= "'";
}
}

return $newString;
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация