Quote by: %3A%3ABenHow can we solve this?
Try commenting out the str_replace and preg_replace function calls one ata time and monitor the output, so you can narrow it down to which exact function call(s) cause the problem. Then it should be easier to come up with a fix.
BTW, shouldn't this be a bug report in the tracker?
Rouslan