Hi,
Even if the question subject seems complicated, the issue is quite simple.
I create an XML file with the following script:
def xmlFile = new File("file-${System.currentTimeMillis()}.xml")
mb = new groovy.xml.StreamingMarkupBuilder()
mb.encoding = "UTF-8"
new FileWriter(exportXmlFile) << mb.bind {
mkp.xmlDeclaration()
out << "\n"
someMarkup {}
}
Then when I parse this file using code like:
def xml = new XmlSlurper().parse(xmlFile)
I got the following MalformedByteSequenceException
exception:
Exception thrown: Invalid byte 2 of 3-byte UTF-8 sequence
And if I convert the file in UTF-8 format (using Notepad++ for instance) then everything is ok.
So, what can I do to save my file in UTF-8 format? Why the code mb.encoding = "UTF-8"
does not do it?
Thx