Closed slang25 closed 1 year ago
Thanks! I thought single quotes didn't really need to be escaped. Did you find a case where it's an issue?
So I coded this up late last night, hence the mistakes 😄
What led me to create this PR is that my test started failing after switching from RazorLight, it is expecting '
for '
.
From some research, it should be encoded to either '
or '
(this is the hex representation), however I chose the hex implementation as it's what the other razor libraries do, and that's what the System.Text.Encodings.Web.HtmlEncoder.Default
implementation does:
System.Text.Encodings.Web.HtmlEncoder.Default.Encode("foo's").ShouldBe("foo's");
So copying this would lead to less surprises for future adopters.
Ok, thanks for the explanation. I'll review this in more detail tonight, but I can already say that:
#else
case in HtmlHelper
HtmlTemplate.Write
needs the same changesThanks for catching those @ltrzesniewski, changes made
I'm thinking this should also handle chars outside of the ASCII range, let me take a quick look at that too
I don't think that's really required, everything handles Unicode now.
I released this in v0.4.3 - thanks! 🙂
Amazing, thanks @ltrzesniewski
This library is great! I found that it doesn't HTML escape single quotes, so here's a small PR...