Moin!
Das Problem mit den BOM haben offenbar viele. Deshalb als Skript für alle:
<?php
function rmBOM($str, $replacment='') {
# source: https://en.wikipedia.org/wiki/Byte_order_mark
$boms=array(
urldecode('%EF%BB%BF'), #UTF-8
urldecode('%FE%FF'), #UTF-16 (BE)
urldecode('%FF%FE'), #UTF-16 (LE)
urldecode('00%00%FE%FF'), #UTF-32 (BE)
urldecode('FF%FE%00%00'), #UTF-32 (LE)
urldecode('2B%2F%76%38'), #UTF-7
urldecode('2B%2F%76%39'), #UTF-7
urldecode('2B%2F%76%2B'), #UTF-7
urldecode('2B%2F%76%2F'), #UTF-7
urldecode('2B%2F%76%38%2D'), #UTF-7
urldecode('%F7%64%4C'), #UTF-1
urldecode('%DD%73%66%73'), #UTF-EBCDIC
urldecode('%0E%FE%FF'), #SCSU
urldecode('%FB%EE%28'), #BOCU-1
urldecode('%84%31%95%33') #GB-18030
);
return str_replace($boms, $replacment, $str);
}
#/* Test:
$s='<klaus.mann@example.de%EF%BB%BF>';
$schadhaft=urldecode($s);
echo 'Schadhaft: ', $schadhaft, "\n";
echo 'Anzeige: ', rmBOM($schadhaft, '#BOM!#'), "\n";
echo 'Bereinigt: ', rmBOM($schadhaft), "\n";
#*/
Jörg Reinholz