-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML entities are not being preserved #37
Comments
For the copyright symbol, this is expected behavior. The entity is This is probably incorrect if it's happening for &. Are you sure it is?
|
I just checked and it looks like it is indeed happening for &. |
@cdsmith Any idea where this might be in xmlhtml? |
https://github.com/snapframework/xmlhtml/blob/master/src/Text/XmlHtml/HTML/Render.hs#L60 Currently, it seems that the '&' character is only escaped when it is an "ambiguous ampersand", as defined at https://www.w3.org/TR/html5/syntax.html#text Non-ambiguous ampersands should not cause HTML validation to fail. I believe there is a reason this is done in this way, and I think it has something to do with certain browsers not liking the escaping of & inside a URL. I don't recall the details. |
Hmmm, I can't decide what to do on this issue. The existing behavior appears to be correct, but on the other hand maybe a few unnecessary entities are tolerable if they are causing validation problems. I think I'm leaning slightly more towards closing this issue and leaving things as-is, but I could certainly be persuaded otherwise. Thoughts? |
All HTML entities found in my templates are being converted to the actual character (eg.
&
becomes&
,©
becomes©
). For most characters, this doesn't matter a whole lot, but a raw ampersand causes HTML validation to fail.Template source:
Rendered document's source:
The text was updated successfully, but these errors were encountered: