I have some HTML stored in a database and I am generating an static HTML file out of it. However when i open the file in the browser, the font doesn't render as I expect it.
I have tracked down the problem and I see it is because of & quot;
<p><span style="font-family: "Roboto Regular";">Some text</span></p>
Now if I replace the & quot;
with double quotes
, it works fine.
This is also generated through C#. What is the best approach to fix this?
Should I just use Replace function
to convert them to quotes or is there a library that I can use to do it more efficiently? or is it even simpler to fix.
Thanks for your thoughts.
You can use System.Web.HttpUtility.HtmlDecode
(and Encode
) to handle this sort of thing.
However you should be asking yourself why your font string includes HTML encoded characters.