Wrong charset from view plugins ZF3

     echo $this->headTitle($meta_data->title);
    ->appendName('description', $meta_data->description);

     ->appendName('viewport', 'width=device-width, initial-scale=1.0')
     ->appendName('x-ua-compatible', 'ie=edge');
  echo $this->headMeta();

And as result of head view helper I see some wrong charset. Have you some idias, how it can be fixed?

1 Like

This has nothing to do with the character set but all HTML attributes are escaped.

You can disable the auto escaping for the view helper: https://docs.zendframework.com/zend-view/helpers/head-meta/#autoescape

Some background information for the topic escaping can be found in the documentation of zend-escaper: https://docs.zendframework.com/zend-escaper/intro/

1 Like

Thank you! But I was seen it in documentation. But it’s not working for me. I was trying:

        ->appendName('description', $meta_data->description);

No result. I have same problem in plugins headScript and headLink:

Maybe ZF have some more global config parameter for escaping?

You must use the latest version of zend-view:

Thank you very much, it was my other mistake, not version.

… is working!
But how about over view helpers?: headScript() and headLink() ? It is not a big problem, all scropts and links working. Is it better to use autoescaping? I need to set autoescape option to false for each other by some specific method? Have I some other way?

Yes. (all informations to this topic can be found in the documentation of zend-escaper; see link above)
If you set the meta tag for the Internet Explorer with X-UA-Compatible then you must set the autoescaping to false.

1 Like

Ok, thank you, I undrstood it.