1

I'm currently having trouble with reading some xml files that have different encodings. Therefore I'm trying to get the encoding out of the xml Declaration.

I know that to create the Declaration you use root.mkp.xmlDeclaration(version:"1.0", encoding:"UTF-8") But I couldn't find a way to read it.

greetings

Fanvaron
  • 155
  • 2
  • 10
  • If your call to parse passes a `File` or `InputStream` it should autodetect the encoding. If you pass a `String` or a `Reader` it won't – tim_yates Jan 23 '14 at 15:54
  • I think he might be trying, after parsing, to output what encoding was detected, maybe for debug purposes. – billjamesdev Jan 24 '14 at 00:24
  • Here's a comment I saw in similiar post - read the file as text and read the first line and parse it out, possibly with a regex, then close the file. Now use XmlSlurper to get the contents. – mikemil Jan 24 '14 at 21:55

0 Answers0