Closed jwv closed 1 year ago
Hi @jwv and thank you for the proposal! It made me review the entire process of escaping and encoding the URLs.
The function htmlspecialchars($url, ENT_QUOTES)
is used for converting single and double quotes to HTML entities - this is a requirement of the sitemap specification. So the function will stay definitely there. If you take a look at the spec, you'll notice that it requires not only to escape ampersands, quotes, and greater than/less than signs but also encode non-ASCII characters to UTF-8. The latter feature was not in place and I added it in #51.
Hi,
The function htmlspecialchars($loc, ENT_QUOTES) no need be call because xmlWriter already convert special characters and was small bug with & (ampersand ).
For example when add URL with
&
was convert to&
Examples:
https://example.com/index.php?param1=1¶m2=2¶m3=3
=>https://example.com/index.php?param1=1&param2=2&param3=3