I fixed this; I found that the data had the following character in
it:
Western hills<perfect for
which was making it look like an extra tag. I've hard coded a fix,
however would really like to see a better option which allows me to
just check the data not all xml as a overall clean on the item: <
didn't work. Please let me know
To fix it in the fix_encoding method I changed it to be the
following:
private function fix_encoding($in_str) {
if ($this->disable_encoding_fix == true) {
return $in_str;
}
$pattern = array();
$pattern[0] = '/\&\s/';
$pattern[1] = '/ills<perfect/';
$replacement = array();
$replacement[0] = '& ';
$replacement[1] = '<';
$in_str = preg_replace($pattern, $replacement,
$in_str);
$cur_encoding = mb_detect_encoding($in_str);
if ($cur_encoding == "UTF-8" &&
mb_check_encoding($in_str, "UTF-8"))
{
return $in_str;
}
else {
return utf8_encode($in_str);
}
}
instead of:
private function fix_encoding($in_str) {
if ($this->disable_encoding_fix == true) {
return $in_str;
}
$in_str = preg_replace($/\&\s/, $& , $in_str);
$cur_encoding = mb_detect_encoding($in_str);
if ($cur_encoding == "UTF-8" &&
mb_check_encoding($in_str, "UTF-8"))
{
return $in_str;
}
else {
return utf8_encode($in_str);
}
}
'