Menu

#131 Wrong XML file encoding

closed
Engine (46)
5
2009-03-29
2009-03-18
No

It seems jGnash does not take into account encoding specified in <?xml ...> header. Probably it uses current locale settings instead.

An uploaded example XML file was created with File -> New menu entry in Windows XP (Rus) environment. The xml header states that file is in utf-8, but in fact it is in Cp1251 (account and currency names are in Cp1251 not utf-8).

Probably related properties from about dialog:
file.encoding: Cp1251
sun.jnu.encoding: Cp1251

The problem exists in 2.1.0 and in trunk (can't tell the revision right now). I did not check other versions.

Discussion

  • Andrey Bondarenko

    A new XML database File -> New (environment Windows XP Rus)

     
  • Andrey Bondarenko

    Quick and dirty patch for svn rev 1544. Works for me, but fails on XML with broken encodings.

     
  • Craig Cavanaugh

    Craig Cavanaugh - 2009-03-24

    Thanks Andrey

    Fix has been committed to trunk.

    When jGnash 1st opens a "2.0" file, it will assume it should use the system encoding which is Cp1251 in your case. Then upon saving, it should save in the UTF-8 encoding, and it will bump the file version to 2.01. From then on, it assumes a file of version 2.01 or greater is UTF-8.

    If you don't mind, would you mind testing with a backup of your file? I'm assuming you are able to compile based on the detailed description.

    Thanks,
    Craig

     
  • Andrey Bondarenko

    Craig,

    I have compiled jGnash from trunk and checked its behavior with backup file. It repairs file on a first open now.

    Thanks,
    Andrey

     
  • Craig Cavanaugh

    Craig Cavanaugh - 2009-03-29
    • status: open --> closed
     

Log in to post a comment.