The sfFillInForm uses a DomDocument? and loadHTML to load its contents. But the loadHTML method assumes ISO-8859-1 encoding when there is no encoding given in the head section. Because AJAX responses do not have a head section in the response, the sfFillInForm does not handle UTF-8 responses correctly.
see: http://at.php.net/manual/en/function.dom-domdocument-loadhtml.php#78243
fix for the loadHTML method (more a quickhack than a fix....):
public function fillInHtml($html, $formName, $formId, $values)
{
$dom = new DomDocument('1.0', sfConfig::get('sf_charset', 'UTF-8'));
if (false === ($pos = strpos($html, '</head>'))) {
$html = '<head><meta http-equiv="Content-Type" content="'.$this->response->getContentType().'"/></head>' . $html;
}
@$dom->loadHTML($html);
$dom = $this->fillInDom($dom, $formName, $formId, $values);
$html = $dom->saveHTML();
if ($pos === false) {
// Remove Header
$end = strpos($html, '<body>');
$html = substr_replace($html, '', 0, $end + 6);
$end = strpos($html, '</body>');
$html = substr_replace($html, '', $end, strlen($html)-$end);
}
return $html;
}