JiBX
  1. JiBX
  2. JIBX-162

org.jibx.extras.TestRoundtrip not handling UTF-8 properly

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: JiBX 1.1.3
    • Fix Version/s: JiBX 1.1.6
    • Component/s: core
    • Labels:
      None
    • Environment:
      Eclipse/Ant
    • Number of attachments :
      0

      Description

      Output when using UTF-8 xml files during the round-trip. (using class org.jibx.extras.TestRoundtrip)
      The text content should be equal.

      [java] Different text content - from line 17, col 13 to line 17, col 16
      [java] "
      [java] <table background="undefined" bgcolor=""><tr><TD valign="top"><A title="Ir para a página inicial do Google" href="http://www.google.com.br/webhp?hl=pt-BR" id="logo">Google<SPAN></SPAN></A></TD></tr></table>
      [java] " (length 214 vs. "
      [java] <table background="undefined" bgcolor=""><tr><TD valign="top"><A title="Ir para a página inicial do Google" href="http://www.google.com.br/webhp?hl=pt-BR" id="logo">Google<SPAN></SPAN></A></TD></tr></table>
      [java] " (length 213)
      [java] Error round-tripping class: blogitfast.structure.Structure
      [java] with input file structure-example.xml and output compared to structure-example.xml
      [java] Saved output document file path C:\Users\Rodrigo\WORK\BlogItFastServer\temp.xml

        Activity

        Hide
        Dennis Sosnoski added a comment -

        It's difficult to tell without the actual files, but I suspect the cause of the error was that TestRoundtrip was doing the comparison between the actual and expected output using a FileReader for the expected output. Since FileReader always uses the default character encoding for the JVM, passing the data in this way would show garbage characters.

        I've changed the TestRoundtrip code to use the character encoding found for the input file when reading the expected output file, which should take care of this problem.

        Show
        Dennis Sosnoski added a comment - It's difficult to tell without the actual files, but I suspect the cause of the error was that TestRoundtrip was doing the comparison between the actual and expected output using a FileReader for the expected output. Since FileReader always uses the default character encoding for the JVM, passing the data in this way would show garbage characters. I've changed the TestRoundtrip code to use the character encoding found for the input file when reading the expected output file, which should take care of this problem.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Rodrigo Dombrowski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: