We use umlauts in links. This looks very good in the browser and Google also shows the umlauts perfectly in the search preview.
When I read in an HTML fragment with umlauts and then output it again, they are replaced by replacement characters.
How can I correct this when reading/outputting? Is there a parameter?
$html = new IvoPetkov\HTML5DOMDocument();
$html->loadHTML('<a href="Ökologie.html" title="Wechselbeziehungen zwischen Lebewesen und ihrer Umwelt">Ökologie - Wechselbeziehungen</a>');
$html->querySelector('body')->innerHTML;
result: <a href="%C3%96kologie.html" title="Wechselbeziehungen zwischen Lebewesen und ihrer Umwelt">Ökologie - Wechselbeziehungen</a>
The umlaut Ö in the link text is correct.
The umlaut Ö in the href was replaced by %C3%96.
We use umlauts in links. This looks very good in the browser and Google also shows the umlauts perfectly in the search preview.
When I read in an HTML fragment with umlauts and then output it again, they are replaced by replacement characters. How can I correct this when reading/outputting? Is there a parameter?
result:
<a href="%C3%96kologie.html" title="Wechselbeziehungen zwischen Lebewesen und ihrer Umwelt">Ökologie - Wechselbeziehungen</a>
The umlaut Ö in the link text is correct. The umlaut Ö in the href was replaced by
%C3%96
.