"Clike" language doesnt work with escaping

I am making a website where people can post their code and it will be stored on the website, like a pastebin.
The language I’m using for it is C# (csharp)

For security reasons, characters are escaped when people insert a new pastebin.~
Imagina a quotation mark. It becomes in html this: “”"
The problem seems that Codemirror thinks that “&” is an operator and the semicolon is the end of the instruction, the result is those 2 become separated and so the quotation mark isn’t displaying properly.

Here’s an example of the code:

Any solutions?

The content of a CodeMirror instance is text, not HTML, so you’ll have to unescape it before giving it to the editor.