Derby
  1. Derby
  2. DERBY-4902

Encoding problem in output from plan exporter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.7.1.1
    • Component/s: Tools
    • Labels:
      None

      Description

      If I execute a query with non-ASCII characters in it, the output from the plan exporter tool is garbled.

      Example query: select * from blåbær

      The HTML output looks like this in the browser: Query: select * from blåbær

      Similar problem with XML: <statement>select * from blåbær</statement>

      1. d4902.diff
        5 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Knut Anders Hatlen created issue -
          Knut Anders Hatlen made changes -
          Field Original Value New Value
          Link This issue relates to DERBY-4587 [ DERBY-4587 ]
          Knut Anders Hatlen made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Knut Anders Hatlen made changes -
          Link This issue blocks DERBY-4774 [ DERBY-4774 ]
          Knut Anders Hatlen made changes -
          Link This issue relates to DERBY-4774 [ DERBY-4774 ]
          Knut Anders Hatlen made changes -
          Link This issue blocks DERBY-4774 [ DERBY-4774 ]
          Hide
          Knut Anders Hatlen added a comment -

          The problem seems to be caused by an inconsistency in CreateXMLFile.writeTheXMLFile(). The header in the generated XML file says that the encoding is ISO-8859-1, but the code the code that produces the output uses the default encoding of the runtime environment.

          The attached patch makes writeTheXMLFile() use UTF-8 consistently (and explicitly). This solved the problem for me both in the XML output and in the HTML output. The patch also adds a test case that runs cleanly with the fix, and fails with the following error without the fix:

          1) testPlanExporterEncoding(org.apache.derbyTesting.functionTests.tests.lang.XplainStatisticsTest)junit.framework.ComparisonFailure: expected:<...LECT * FROM D4902_BL[ÅBÆ]R> but was:<...LECT * FROM D4902_BL[ÅBÆ]R>

          Show
          Knut Anders Hatlen added a comment - The problem seems to be caused by an inconsistency in CreateXMLFile.writeTheXMLFile(). The header in the generated XML file says that the encoding is ISO-8859-1, but the code the code that produces the output uses the default encoding of the runtime environment. The attached patch makes writeTheXMLFile() use UTF-8 consistently (and explicitly). This solved the problem for me both in the XML output and in the HTML output. The patch also adds a test case that runs cleanly with the fix, and fails with the following error without the fix: 1) testPlanExporterEncoding(org.apache.derbyTesting.functionTests.tests.lang.XplainStatisticsTest)junit.framework.ComparisonFailure: expected:<...LECT * FROM D4902_BL [ÅBÆ] R> but was:<...LECT * FROM D4902_BL [ÅBÆ] R>
          Knut Anders Hatlen made changes -
          Attachment d4902.diff [ 12459594 ]
          Hide
          Knut Anders Hatlen added a comment -

          All the regression tests ran cleanly.

          Committed revision 1035238.

          Show
          Knut Anders Hatlen added a comment - All the regression tests ran cleanly. Committed revision 1035238.
          Knut Anders Hatlen made changes -
          Status In Progress [ 3 ] Closed [ 6 ]
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Resolution Fixed [ 1 ]
          Rick Hillegas made changes -
          Affects Version/s 10.7.1.1 [ 12315564 ]
          Affects Version/s 10.7.1.0 [ 12314971 ]
          Fix Version/s 10.7.1.1 [ 12315564 ]
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Gavin made changes -
          Workflow jira [ 12526824 ] Default workflow, editable Closed status [ 12799790 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          1h 5m 1 Knut Anders Hatlen 15/Nov/10 11:02
          In Progress In Progress Closed Closed
          1h 2m 1 Knut Anders Hatlen 15/Nov/10 12:04

            People

            • Assignee:
              Knut Anders Hatlen
              Reporter:
              Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development