XMLDocument Declaration UTF-8 Error if lower case utf-8

Oxygene, RTL, Island on Windows

Processing XML declarations appears to be case sensitive, if an encoding of ‘utf-8’ in lower case is encountered an exception is raised. When in upper case ‘UTF-8’, there are no exceptions and it works.

<?xml version="1.0" encoding="UTF-8"?>

vs

<?xml version="1.0" encoding="utf-8"?>

Live Urls for example;

  // XML declaration of UTF-8 (case important)
  var rss1 := Url.UrlWithString("https://www.sott.net/xml_engine/signs_rss");

  // XML declaration of utf-8 (case important)
  var rss2 := Url.UrlWithString("https://rss.packetstormsecurity.com/news/");

  var doc := XmlDocument.FromUrl(rss1); // UTF-8 , 1st url no issues

  var doc := XmlDocument.FromUrl(rss2); // uft-8 second url results in
  //!> Exception of type RemObjects.Elements.System.Exception on thread 0EE8
  //!> Message: Unknown Encoding "utf-8"
  //!> Exception of type RemObjects.Elements.RTL.XmlException on thread 0EE8
  //!> Message: Unknown encoding 'utf-8' at 1/37

which platform is this?

(I can see why this would be broken in Toffee and Island, and i’ve fixed that (and potentially the other platforms too, but I didnt test them)

This was on Island, Windows 11 x86_64

Thanks Marc

1 Like

Cool. can you see if using latest from GitHub fixes this?

I cloned GitHub - remobjects/RTL2: Next Generation RTL for Elements — replaces Sugar. , built and referenced this Elements.fx and I had no issues, I tested both cases on Island, Windows 11 x86_64

1 Like

happy to hear!