5

I want to put an HTML entity (in particular, ©) into my document. However if I type it and feed it as a Text straight into a blaze combinator, the ampersand is html-escaped and comes out as literally © -- or rather, the HTML outputted is ©, which is kind of ironic.

(If I use blaze-from-html on HTML that contains ©, blaze-from-html turns it into the unicode copyright symbol "©", which works, but I'd still like to know if it was possible to access the lower-level HTML with blaze and type a literal html-source &.)

Justin L.
  • 13,510
  • 5
  • 48
  • 83

1 Answers1

4

If you are using the blaze Text.Blaze.Html.toHtml function, there is a corresponding preEscapedToHtml function that will not escape entities. Sample ghci session -

λ> renderHtml $ toHtml "©"
"©"
λ> renderHtml $ preEscapedToHtml "©"
"©"
Anupam Jain
  • 7,851
  • 2
  • 39
  • 74