Now, the Google Search Console reports 404 errors for the following URLs:

http://example.com/example
http://example.com/another-example

Note, that the strings after the %23 got stripped away. I would understand this behavior, if the sitemap contained e.g. http://example.com/example#1, but we’re intentionally encoding the hash (http://example.com/example%231).

Is there anything I might be misunderstanding, or are there any special rules for escaping within sitemap.xml?