I didn't find a good way to set the encoding for DOMDocument::loadHTML(), and wrapping $str in a proper <html><head><meta charset=…></head><body>…</body></html> broke things - feel free to reject if you know a better way.
I think it's ok to hardcode UTF-8 here though as if I interpret the note on http://php.net/manual/en/class.domnode.php correctly the $e->nodeValue passed to parseEvent() should already be decoded to UTF-8.
I didn't find a good way to set the encoding for DOMDocument::loadHTML(), and wrapping $str in a proper
<html><head><meta charset=…></head><body>…</body></html>
broke things - feel free to reject if you know a better way.I think it's ok to hardcode UTF-8 here though as if I interpret the note on http://php.net/manual/en/class.domnode.php correctly the
$e->nodeValue
passed to parseEvent() should already be decoded to UTF-8.