X.Web.Sitemap icon indicating copy to clipboard operation
X.Web.Sitemap copied to clipboard

Utf8 issue

Open codingyourlife opened this issue 3 years ago • 2 comments
trafficstars

Google says here: Sitemap files must be UTF-8 encoded, and URLs escaped appropriately.

This validator showed me an error until I manually programatically modified first line of xml to be utf-8 instead of 16 and extended FileSystemWrapper.cs to have Encoding.UTF8 as 3rd argument to StreamWriter.

codingyourlife avatar Sep 03 '22 15:09 codingyourlife

I do it like that to get rid of xmlns:* which is not part of google search console help page and to change utf-16 to utf-8

var xmlString = xmlDocument.ToXmlString(); xmlString = Regex.Replace(xmlString, @" xmlns:.?"".?""", ""); xmlString = xmlString.Replace("encoding="utf-16"", "encoding="utf-8"");

and for file save as said FileSystemWrapper needs to be changed (highlighted part) image

@ernado-x can this (especially the image) be changed any time soon?

codingyourlife avatar Sep 03 '22 15:09 codingyourlife

@codingyourlife could you please provide example code where you receive utf-16?

a-gubskiy avatar Sep 03 '22 17:09 a-gubskiy