Developer forum

Forum » CMS - Standard features » Sitemap.xml encoding

Sitemap.xml encoding

Thomas Larsen
Reply

Hi,

After upggading to DW 9.13.2 /Sitemap.xml returns utf-16 as incoding in the xml header, but the content of the sitemap is utf-8



This result in the following error when validating the sitemap
Document labelled UTF-16 but has UTF-8 content on line 1

BR
Thomas


Replies

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi,

The bug will be fixed by task 7491 has been created. Thanks for finding.

BR, Oleg QA

 
Jon Thorne
Jon Thorne
Reply

Hi Oleg,

This seems still to be a bug in 10.8.13. Has this been fixed?

 

Regards,

Jon.

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Jon,

I was not able to reproduce the bug on DW10.17.0 at least, use actual admin version, please. 

BR, Oleg QA

2025-08-04_13-39-11.png
 
Jon Thorne
Jon Thorne
Reply

Hi Oleg,

I can try and update to a newer version and test again. I was just surprised if it was fixed in 9.13 it would still be a problem in any DW10 version. Perhaps an issue with our server settings?

You can see what I am getting here: https://carrotsolutions.com.au/sitemap.xml

Regards,

Jon.

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi

This seems to be depending on the server.

We are explicitly defining UTF8 in the xmlwrite settings:

private static readonly XmlWriterSettings xmlWriterSettings = new() { Indent = true, Async = true, Encoding = Encoding.UTF8 };

But since we are writing to a Stream in later versions of sitemap middleware, the xmlwriter encoding is discarded - so I have just updated the middleware to use StreamWriter instead - and explicitly setting it to utf8.

devops#24998

https://doc.dynamicweb.dev/documentation/fundamentals/dw10release/releasenotes/workiteminfo.html?workitemid=24998

BR Nicolai

 
Jon Thorne
Jon Thorne
Reply

Hi Nicolai,

Thanks for checking this. Would you happen to know where I could look to change that on my server? Or just wait for the update?

Regards,

Jon.

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Not what I can find...

You can try this in web.config if running IIS:

<configuration>
  <system.web>
    <globalization
      fileEncoding="utf-8"
      requestEncoding="utf-8"
      responseEncoding="utf-8" />
  </system.web>
</configuration>

But I am not sure it will work.

 

You must be logged in to post in the forum