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

          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.
          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>

            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