A controller passes an array to a twig template. The array contains strings that correctly UTF-8 encoded. I can check this in the controller with var_dump($theArray). All strings are displayed correctly.
But in twig
{% for video in videos %}
{{ video.title_value | raw }} <br>
{% endfor %}
some characters like Ö,Ä,Ü are replaced by this �. The controller and the template are encoded UTF-8 without BOM and
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
is set. I have to do the raw output because the strings may contain html tags. Any idea how to fix the �?
I’m not sure that your source data is actually UTF-8 encdoded.
var_dump()alone isn’t sufficient to verify the encoding of your content.Try echoing/dumping the content and viewing the page with Firefox or Chrome and change the encoding to UTF-8 and then something else like ISO-8859-1. If your content looks wrong when you have UTF-8 selected then your content is not UTF-8 encoded.