Evtl. hilft dir ja das weiter. Hatte das noch hier rumliegen. Is ewig alt und ungetestet.
PHP-Code:function stripAscii($text, $break)
{
// First, remove all "weird" characters.
$text = preg_replace("/[^a-zA-Z0-9öäüÖÄÜß\\-_?!&[\\]().,;:+=#*~@\\/\\\\'\"><\\s]/", "", $text);
//$text = preg_replace("cpN/cRo", "", $text);
//$text = preg_replace("cpN!", "", $text);
//$text = str_replace (chr(20), " ", $text);
while ($text != $oldtext) {
$oldtext = $text;
// Remove all repeating umlauts
$text = preg_replace("/[öäüÖÄÜß]{2,}/", "", $text);
// Remove all "free" umlauts, not enclosed by other word chars
$text = preg_replace("/(^|\\s)[öäüÖÄÜß]+(\\s|$)/sm", "", $text);
}
$text = preg_replace("/ {2,}/", "", $text);
$text = trim($text);
if ($break == "yes")
{
$text .= "\r";
}
// Remove trailing spaces at end of line
// $text = preg_replace("/([\\t ]+)(\\s$)/m", "\r2", $text);
//$text = preg_replace("/\\r1{2,}/", "", $text);
//$text = preg_replace('#(?<!\r\n)\r\n(?!\r\n)#', ' ', $text);
return $text;
}




Zitieren