Body Summary field showing literal ampersand character code in view I have a Drupal 8 site where we've created a view, and decided to use the summary field instead of the trimmed body field, so that we could have more control over it. 

However, I got a bug report that the page had funny characters. When I looked, I found that a literal ampersand character, &amp;, was changed to the HTML code &amp;amp;. 

Thinking this was some weirdness introduced by our settings and configuration, I built a view on a clean install of Drupal 8.7.3 and generated some nodes with devel_generate. Sure enough, the ampersand HTML code appeared. 

Node:



View Page preview:



View Page:



So, I want to get this to display a regular ampersand, as the user entered it. 

I found this question explaining how to modify a twig template to use the raw value, but I'm not sure that's what I want to use. I don't want raw values for the whole field-- users could enter HTML in the summary field; I just want a non-encoded ampersand.

How do I get unencoded ampersands in the summary field in a view?

Edit leymannx recommended to uncheck Display any HTML as plain text on the text formats filter. However, both on my test fresh install and my real site, that filter is not checked, for any format. 

I did my fresh install from downloading the Drupal core, and I think leymannx  user composer, so I am going to try that, to see if I get the same behavior as he does.  Also, I'm not going to install the devel modules to generate content, I'm just going to do one by hand.

These are screenshots from my fresh install:





Also a screenshot from my actual environment: 



So, from those settings, it doesn't seem like the filter is what's causing this behavior.

Edit 2 I found something that I now suspect as perhaps the source of the error. The view on the fresh install is a view of files. I did not find the summary field in the list of fields, so I added a body field and re-wrote it with {{ body__summary }}. This is the config export yaml of the view I created.
This is to confirm and clarify the issue according to my findings.
1. I was able to reproduce your findings by using a fresh Drupa 8.7.3 install and after importing your view in which you used the {{ body__summary }} rewrite.

2. I was able to reproduce the error by enabling Display any HTML as plain text option in Basic HTML text format.
3. I was also able to reproduce the error by rewriting the view field output and choosing {{ body__value }} which basically prints the raw value of the body field.  

My opinion is that 2 &amp; 3 are normal behavior and it should be expected that in these particular cases the raw HTML is displayed. However, in 1, it seems a bug because the summary shouldn't be displayed as raw HTML; it should follows the same rules as the selected format.
I suggest to open an issue in Drupal issue tracker telling them about 1; maybe there is a reason behind this behavior, or if somebody already knows the answer, please elaborate.  

Regards