Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2542

Missing hyphen in XML declaration encoding created by StreamingMarkupBuilder

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.1
    • 1.5.6, 1.6-beta-1
    • XML Processing
    • 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()
      }
      

      Attachments

        1. XMLTest.groovy
          0.3 kB
          Brian Alexander

        Activity

          People

            paulk Paul King
            balexand Brian Alexander
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: