#1463 XML support for <?xml encoding=... >

jdonnerstag Sat 26 Mar 2011

Am I right to assume that Fantom not yet supports xml declarations, especially the encoding attribute as in <?xml encoding="whatever" ?> (http://xmlwriter.net/xml_guide/xml_declaration.shtml). I scanned the source code for XParser but couldn't find any related code.

I understand that, as a workaround, &# can be used instead. But since numerous editors and IDEs (including Eclipse) support it by now, it'd be nice if it were supported by Fantom as well.

Am I than right to assume that the OS default encoding is used? Or -Dfile.encoding=whatever in case of JVM. Or does Fantom have something similar? What encoding is used for property files? I saw sys:Charset defaults to utf8.

I'm new to Fantom, but I'd be willing to provide a patch for XParser.

-Juergen

brian Sat 26 Mar 2011

Hi Juergen,

Welcome to Fantom!

Right now XParser just decodes using the charset of the InStream passed into it. By default everything across the board uses UTF-8 in Fantom (source files and all I/O streams).

You can explicit change the encoding using:

Login or Signup to reply.