1

I have a formatted text field using the basic_html filter, which is set up like this:

enabled filters

allowed HTML tags

It is removing HTML unicode entities, in the format &#x<hex>; for example, the Euro symbol is &#x80; which becomes €.

But this is not appearing in content. When I look at the source code, it is showing a little box, e.g. €65 becomes box. But if I edit the node in CKEditor, it shows the Euro symbol there.

If I call $node->get('field_my_field') then I see the values is an array like:

$values = [
  'value' => 'Content\n<br />Example content: &#x80;65',
  'format' => 'basic_html',
];

So at some point when it goes through check_markup(), this entity is being turned into a Unicode character which is then for some reason invisible on the page.

I've tried all sorts of messing around with html_entity_decode() and htmlspecialchars() but just end up breaking the HTML tags. I'm not sure what I can do other than a str_replace() of all possible entities I think might occur.

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.