WebMarkupMin
WebMarkupMin copied to clipboard
Minified attributes seem to be double encoded
When WebMarlupMin minifies something like this: span class="button close" data-icon="" aria-hidden="true" it comes out with the ampersand encoded like this: span class="button close" data-icon="" aria-hidden="true" (opening and closing html tag removed since github filters them out)
Hello, Tom!
It seems to me that there should be a semicolon in the value of this attribute:
<span class="button close" data-icon="" aria-hidden="true">…</span>
I will try to fix this error during the next week.
Hello, Tom!
In the beginning, I thought that I could quickly fix this problem by simply editing one line of code, but it turned out to be much more complicated. System.Net.WebUtility.HtmlDecode method that I'm using to decode does not support HTML entities without a semicolon. Unfortunately, there is no ready-made analogue of the he library for .NET, so it will take quite a long time to implement such functionality. In general, usage of the HTML entities without a semicolon is a rather controversial thing (see the “Are there some valid HTML entities without the semicolon?” discussion on Stack Overflow).
I can't exclude the &
→ &
conversion either, because the minified code will no longer be compatible with older versions of HTML. In one of the future releases, I plan to add a OutputLanguage
property to the settings, with which it will be possible to specify the supported version of language. Already in the longer term, I plan to write my own HTML decoder, but it seems to me that it will be several times slower than the System.Net.WebUtility.HtmlDecode.
At the moment I recommend that you manually add semicolons to the HTML entities.
Hey Andrey,
You've already pointed me in an excellent direction. I'll look into using the semicolon, which is fine if our code works with it, that's a fixable situation. I'm also quite pleased with the speed of your response .. So big kuddos to you ;-)