Protecting gnucash 1.8.x from utf8 locales

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Protecting gnucash 1.8.x from utf8 locales

Didier Vidal
[Resent, my first email bounced because I was not member of the list]

Some linux distribs (including Fedora) set UTF 8 locales by default.
With such locales, GnuCash doesn't behave correctly. In particular,
reports are not displayed correctly (utf8 chars are split in two).
This patch transforms UTF_8 locales into their base locale at startup
and displays a warning.
It assumes locale naming schemes as described at
http://www.linux.org/docs/ldp/howto/Unicode-HOWTO-3.html#ss3.4 and
http://www.iana.org/assignments/character-sets


Note:
This patch is not transparent to gnucash users who already created files
with an utf8 locale. Account names or transaction names they entered
that had unicode letters are no longer displayed correctly. I'll try to
work on a different patch that help display the html reports correctly
also with in an utf8 locale, the only problem I've observed with
gnucash/UTF-8 with fedora's package.
By the way I also observed that gnucash does not write the encoding in
the XML file that is saved. That might be the source of some
locale-related problems, and definitely might be a problem for people
that exchange gnucash files.

Didier Vidal.

_______________________________________________
gnucash-patches mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-patches

utf8protect.patch (444 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Protecting gnucash 1.8.x from utf8 locales

Christian Stimming
Dear Didier,

this patch is still pending, isn't it? Has there been any discussion
whether this solution is a good one for the gnucash-1-8-branch?

In fact I have been implementing this patch manually ever since I
switched to SuSE9.3, which has a UTF-8 locale by default. I.e. I added
"export LANG=de_DE" to the gnucash script, and I recommended this to all
the other Germany that complained about the utf8 chars. I'm not sure
whether your concerns about the files from the utf-8 locales are really
valid. I think that would only be the case if people started gnucash,
saw the weird characters, but went ahead nevertheless and entered the
new account names. However, I think that this wouldn't be the case --
people would first want to fix the weird characters, and that
necessarily means they will switch the gnucash context to non-utf8.
Also, if they use the account templates that are shipped with gnucash,
then the account names are in latin1 anyway.

So becasue for gnucash-1.8.x we know for sure that the respective
libgnomeui doesn't support UTF-8, I think this change is a usable
solution and should be committed to the gnucash-1-8-branch.

Christian

Didier Vidal schrieb:

> [Resent, my first email bounced because I was not member of the list]
>
> Some linux distribs (including Fedora) set UTF 8 locales by default.
> With such locales, GnuCash doesn't behave correctly. In particular,
> reports are not displayed correctly (utf8 chars are split in two).
> This patch transforms UTF_8 locales into their base locale at startup
> and displays a warning.
> It assumes locale naming schemes as described at
> http://www.linux.org/docs/ldp/howto/Unicode-HOWTO-3.html#ss3.4 and
> http://www.iana.org/assignments/character-sets
>
>
> Note:
> This patch is not transparent to gnucash users who already created files
> with an utf8 locale. Account names or transaction names they entered
> that had unicode letters are no longer displayed correctly. I'll try to
> work on a different patch that help display the html reports correctly
> also with in an utf8 locale, the only problem I've observed with
> gnucash/UTF-8 with fedora's package.
> By the way I also observed that gnucash does not write the encoding in
> the XML file that is saved. That might be the source of some
> locale-related problems, and definitely might be a problem for people
> that exchange gnucash files.
>
> Didier Vidal.
>
>
> ------------------------------------------------------------------------
>
> --- gnucash-1.8.11/src/bin/generate-gnc-script 2003-01-23 07:30:21.000000000 +0100
> +++ gnucash-1.8.11.utf8protect/src/bin/generate-gnc-script 2005-09-05 00:00:00.255954108 +0200
> @@ -15,6 +15,8 @@
>  GUILE_WARN_DEPRECATED="no"
>  export GUILE_WARN_DEPRECATED
>  
> +(echo \$LANG | grep  UTF-8 > /dev/null ) &&  LANG=\`echo \$LANG | sed s/\.UTF-8//\` && echo UTF-8 not supported. Setting LANG to \$LANG
> +
>  exec "${TARGET_SCRIPT}" "\$@"
>  EOF
>  
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gnucash-patches mailing list
> [hidden email]
> https://lists.gnucash.org/mailman/listinfo/gnucash-patches
_______________________________________________
gnucash-patches mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-patches
Reply | Threaded
Open this post in threaded view
|

Re: Protecting gnucash 1.8.x from utf8 locales

Didier Vidal
Le lun 17/10/2005 à 11:07, Christian Stimming a écrit :
> Dear Didier,
>
> this patch is still pending, isn't it? Has there been any discussion
> whether this solution is a good one for the gnucash-1-8-branch?
I haven't been aware of such discussion. Actually, until recently, the
idea was that there would be no more release of gnucash 1.8.
>
> In fact I have been implementing this patch manually ever since I
> switched to SuSE9.3, which has a UTF-8 locale by default. I.e. I added
> "export LANG=de_DE" to the gnucash script, and I recommended this to all
> the other Germany that complained about the utf8 chars. I'm not sure
> whether your concerns about the files from the utf-8 locales are really
> valid. I think that would only be the case if people started gnucash,
> saw the weird characters, but went ahead nevertheless and entered the
> new account names.
Actually, this happened to me: I had no problem unless I used reports. I
believed that reports were broken and didn't use them :-).
After I applied the patch, I had to modify some labels in my
transactions.

The worst case scenario is if the user has started to enter data in
utf-8, then adds more entries in ISO-8859-1. When the user will switch
to Gnucash G2, libxml2 will fail to convert a mixed file (it will still
read it, but fail to convert ISO-8859-1 to utf-8)

> However, I think that this wouldn't be the case --
> people would first want to fix the weird characters, and that
> necessarily means they will switch the gnucash context to non-utf8.
> Also, if they use the account templates that are shipped with gnucash,
> then the account names are in latin1 anyway.
That's probably why I didn't use them :-)

>
> So becasue for gnucash-1.8.x we know for sure that the respective
> libgnomeui doesn't support UTF-8, I think this change is a usable
> solution and should be committed to the gnucash-1-8-branch.
That's a difficult decision... One could argue that there is no big
problem for the moment (gnucash users don't complain), and there is a
risk to add this patch... On the other hand, non English-speaking people
that used gnucash with an utf8 locale (that's the case on fedora), may
think that gnucash is broken....

Didier.

>
> Christian
>
> Didier Vidal schrieb:
> > [Resent, my first email bounced because I was not member of the list]
> >
> > Some linux distribs (including Fedora) set UTF 8 locales by default.
> > With such locales, GnuCash doesn't behave correctly. In particular,
> > reports are not displayed correctly (utf8 chars are split in two).
> > This patch transforms UTF_8 locales into their base locale at startup
> > and displays a warning.
> > It assumes locale naming schemes as described at
> > http://www.linux.org/docs/ldp/howto/Unicode-HOWTO-3.html#ss3.4 and
> > http://www.iana.org/assignments/character-sets
> >
> >
> > Note:
> > This patch is not transparent to gnucash users who already created files
> > with an utf8 locale. Account names or transaction names they entered
> > that had unicode letters are no longer displayed correctly. I'll try to
> > work on a different patch that help display the html reports correctly
> > also with in an utf8 locale, the only problem I've observed with
> > gnucash/UTF-8 with fedora's package.
> > By the way I also observed that gnucash does not write the encoding in
> > the XML file that is saved. That might be the source of some
> > locale-related problems, and definitely might be a problem for people
> > that exchange gnucash files.
> >
> > Didier Vidal.
> >
> >
> > ------------------------------------------------------------------------
> >
> > --- gnucash-1.8.11/src/bin/generate-gnc-script 2003-01-23 07:30:21.000000000 +0100
> > +++ gnucash-1.8.11.utf8protect/src/bin/generate-gnc-script 2005-09-05 00:00:00.255954108 +0200
> > @@ -15,6 +15,8 @@
> >  GUILE_WARN_DEPRECATED="no"
> >  export GUILE_WARN_DEPRECATED
> >  
> > +(echo \$LANG | grep  UTF-8 > /dev/null ) &&  LANG=\`echo \$LANG | sed s/\.UTF-8//\` && echo UTF-8 not supported. Setting LANG to \$LANG
> > +
> >  exec "${TARGET_SCRIPT}" "\$@"
> >  EOF
> >  
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > gnucash-patches mailing list
> > [hidden email]
> > https://lists.gnucash.org/mailman/listinfo/gnucash-patches

_______________________________________________
gnucash-patches mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-patches
Reply | Threaded
Open this post in threaded view
|

Re: Protecting gnucash 1.8.x from utf8 locales

Jon Lapham
In reply to this post by Christian Stimming
Christian Stimming wrote:
> this patch is still pending, isn't it? Has there been any discussion
> whether this solution is a good one for the gnucash-1-8-branch?

Just for the sake of completeness, here is a thread that was started 2
years ago for a similar patch I proposed.  Someone complained that it
would cause them problems.

http://www.gnucash.org/pipermail/gnucash-devel/2003-September/010418.html

PS: Christain, I too manually patch every gnucash installation to remove
the UTF8 as you do, and every major distro for the last few years has
defaulted to UTF8...

PSS: For what it is worth, there is precedent for other non-UTF8
supporting apps to strip the UTF8 off the LANG var: "nedit"
(www.nedit.org) does this.

--
-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
  Jon Lapham  <[hidden email]>                Rio de Janeiro, Brasil
  Personal: http://www.jandr.org/
***-*--*----*-------*------------*--------------------*---------------

_______________________________________________
gnucash-patches mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-patches