Testing locale change from gnucash 1.8 to gnucash-g2

Didier Vidal didier-devel at 9online.fr
Sat Sep 24 12:21:03 EDT 2005


GnuCash has a problem with encoding: it doesn't write the encoding
system in the XML files it saves.
(if encoding is not utf-8 or utf-16, it must be specified:

The potential problems are:
    - If someone switches to a new linux distrib (that uses an other
locale) and wants to use files created on the old distrib
    - If someone switches to gnucash-g2 and wants to use it in utf8
    - If someone sends a gnucash file by email to a friend that runs an
other locale on the machine

Fortunately, libxml2 seems to have a robust behaviour (described at
http://www.xmlsoft.org/encoding.html#implemente ). I ran some tests and
gnucash-g2 seems to load properly my gnucash 1.8 files (created with
charset ISO-8859-1) even if the current locale has an utf-8 charset (my
default locale is fr_FR.UTF-8, but I run gnucash 1.8 with fr_FR).

>From these *limited* tests, the problem seems not to be a big problem
for users that will migrate to the gnome 2 version of gnucash. In case
of problems, the workaround would be simple anyway: users should edit
the xml file and replace 
<?xml version="1.0"?>
by<?xml version="1.0" encoding="(result of 'locale charmap')"?>

However, from my tests, gnucash still doesn't follow the XML standard:
   - It will save your files in the locale's charset without writing the
encoding in the header.
   - The non-ascii chars seem to be written as entities (eg: &#xE9;).
They might be read without problem if you are in a wrong locale, but
will not be converted to the right character. Because libxml2 is smart,
and can guess encoding, I haven't seen any actual problem if you are
using your files only with gnucash.

It would be better to write the encoding in the XML file. I'll try to
see if I can find time to make a patch for it, but I can't promise
anything. So, if someone volunteers in the mailing list, let me know :-)


More information about the gnucash-devel mailing list