Our news section has a plain text field for article header. At the time of development this seemed like a good idea, however, having gone live, some languages like French has special characters which is now causing rendering issues as example:
Is rendered as:
I understand why this is happening as text fields are "escaped" for security reasons. The problem here is one of hindsight:
- We cannot delete the field or "convert" the field to a formatted text as that would require all languages to redo all of the articles
- We cannot add any additional filters in the "view" as there isn't a filter allowing me to say "please allow certain characters" as in this case l' is considered an escaped character in the database.
I assume my only option is to try and override the value in my twig file: (views-view-fields--news.html.twig):
<div class="col-md-4">
<div class="card newscard"> {{ fields.field_summary_image.content }}
<div class="card-body">
<h5 class="card-title">
<a href="{{ fields.view_node.content|render|striptags|trim }}">{{ fields.field_article_title.content|render|striptags }}</a>
</h5>
<p>{{ fields.created.content|render|striptags|trim }}</p>
</div>
</div>
</div>
I have however tried to obtain the raw value but cannot get the raw value as this is a rendered "field" (which renders the wrapping HTML along with content).
I have also tried to move this to the unformatted view (views-view-unformatted--news.html.twig):
<div class="card-deck" id="ajaxnewscontainer">
{% for row in rows %}
<div class="col-md-4">
<div class="card newscard"> {{ fields.field_summary_image.content }}
<div class="card-body">
<h5 class="card-title">
<a href="{{ fields.view_node.content|render|striptags|trim }}">{{ fields.field_article_title.content|render|striptags }}</a>
</h5>
<p>{{ fields.created.content|render|striptags|trim }}</p>
</div>
</div>
</div>
{% endfor %}
</div>
However, in this scenario I am not getting any values as doing a {{ dump(row) }} renders my 32GB of RAM useless so cannot determine how to obtain the "row" array elements so that I can hopefully end up getting the "raw" value of fields.field_article_title.content|render|striptags
Any ideas?