Htmlspecialchars with Exception <br> tag

Hi,

I need to use Htmlspecialchars for decoding some weird chars like ä,ö,ü otherwise they are shown wrong.
But the problem is, that I dont want to decode “br” tag, because it should be literally printed out like this.

I have an array, which contains such weid chars and br tag. I want to decode the weird chars, but not decode the br tag.

How do I do?

Same problem like this: https://stackoverflow.com/questions/7353718/why-are-my-br-tags-getting-converted-to-ltbr-gt?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Try nl2br() after decoding.

Did you set the character set for your html page? UTF-8 should be able to display those characters.

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
1 Like

I’m not very sure, but I will look now and reply back to you as soon as possible.

Okay solved the problem. First of all, it was xml file whiches format was encoded in br tags anyway. I should have looked into the xml files.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.