Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.1
-
None
-
Java 1.6.0_03, Windows XP
Description
The code below produces this XML:
<?xml version="1.0" encoding="UTF8"?> <message>Hello World</message>
The encoding should be "UTF-8".
import java.nio.charset.* import groovy.xml.* def xml = new StreamingMarkupBuilder().bind{ mkp.xmlDeclaration() message("Hello World") } def fw = null try { fw = new OutputStreamWriter(new FileOutputStream("helloworld.xml"), Charset.forName("UTF-8")) fw << xml } finally { fw?.close() }