Groovy
  1. Groovy
  2. GROOVY-5158

Encoding issue with groovy.xml.XmlUtil.serialize()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 2.0-beta-3, 1.8.7
    • Component/s: None
    • Labels:
      None

      Description

      http://groovy.329449.n5.nabble.com/Encoding-issue-with-groovy-xml-XmlUtil-serialize-td5038513.html

      I think it should be possible to put an 'ü' charter in the xml element.

      def xml ="""<?xml version="1.0" encoding="UTF-8"?>
      <Schlüssel>
      text content
      </Schlüssel>"""

      groovy.util.slurpersupport.GPathResult s = new XmlSlurper().parseText(xml)

      println groovy.xml.XmlUtil.serialize(s) // results in empty xml, why?

      ----- OUTPUT
      <?xml version="1.0" encoding="UTF-8"?>

      WORKAROUND
      def outxml = new groovy.xml.StreamingMarkupBuilder().with {
      encoding = 'UTF-8'
      '<?xml version="1.0" encoding="UTF-8"?>\n' + bindNode( s )
      }
      println outxml

        Activity

        Anders created issue -
        Hide
        Jan Weitz added a comment -
        Show
        Jan Weitz added a comment - GET fix from pull request https://github.com/groovy/groovy-core/pull/23
        Hide
        Paul King added a comment -

        Should be fixed now. Jan, thanks for the pull request. I used the idea but not the implementation - more details on github. Anders, thanks for spotting the issue.

        Show
        Paul King added a comment - Should be fixed now. Jan, thanks for the pull request. I used the idea but not the implementation - more details on github. Anders, thanks for spotting the issue.
        Paul King made changes -
        Field Original Value New Value
        Assignee Paul King [ paulk ]
        Fix Version/s 2.0-beta-3 [ 18244 ]
        Fix Version/s 1.8.7 [ 18317 ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12734082 ] Default workflow, editable Closed status [ 12745901 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12971620 ] Default workflow, editable Closed status [ 12979453 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        72d 10h 12m 1 Paul King 12/Feb/12 03:52
        Resolved Resolved Closed Closed
        90d 23h 37m 1 Paul King 13/May/12 04:30

          People

          • Assignee:
            Paul King
            Reporter:
            Anders
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development