为了转换我的法语 html 口音,我尝试通过在 Twig 中执行以下操作来更改编码:
{{ ddf.description | convert_encoding('UTF-8', 'HTML-ENTITIES') }}
但这是我收到的消息:
渲染模板期间引发异常(“注意:iconv():错误的字符集,不允许从‘HTML-ENTITIES’转换为‘UTF-8’”)。
任何想法 ?
“HTML-ENTITIES”不是一种编码。
它是一个将 (ISO ... UTF ...) 中的特殊字符/重音编码转换为相同编码中的等效字符或不取决于功能和语言的转换函数。
PHP htmlentities函数:http://php.net/manual/en/function.htmlentities.php http://php.net/manual/en/function.htmlentities.php
这是 html 实体表:https://www.freeformatter.com/html-entities.html https://www.freeformatter.com/html-entities.html
以下是 iconv 支持的编码列表:如何在 php 中获取 iconv 库支持的编码列表? https://stackoverflow.com/questions/8039232/how-to-get-list-of-supported-encodings-by-iconv-library-in-php
您可以尝试使用“| raw”树枝过滤器或创建您自己的过滤器。
Twig 中的 Unescape 或 html 解码(PHP 模板) https://stackoverflow.com/questions/15453579/unescape-or-html-decode-in-twig-php-templating
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)