After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 120219 - gnumeric --help shows UTF-8 and non UTF-8 mixtured.
gnumeric --help shows UTF-8 and non UTF-8 mixtured.
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: General
git master
Other Linux
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2003-08-19 08:05 UTC by ynakai
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
LANG=ja_JP.eucJP : Gnumeic part ('Application options') is unreadable while GTK+ part shows sane Japanese (41.45 KB, image/png)
2003-08-20 10:43 UTC, ynakai
  Details
LANG=ja_JP.UTF-8 : Gnumeric part shows sane Japanese texts too. (40.56 KB, image/png)
2003-08-20 10:44 UTC, ynakai
  Details
Sample test case for discussion (1.43 KB, text/plain)
2003-08-20 10:54 UTC, ynakai
  Details
The patch to delay bind_textdomain_codeset() until argparse ends up. (1.17 KB, patch)
2003-08-21 08:25 UTC, ynakai
none Details | Review

Description ynakai 2003-08-19 08:05:10 UTC
'gnumeric --help' on LANG=ja_JP.eucJP environment,
it shows up UTF-8 strings for Gnumeric part and
EUC-JP strings for Bonobo/GTK+/GNOME-lib part.
Then, users will see scrambled with any text viewer.

With LANG=ja_JP.UTF-8, it shows UTF-8 strings
for Gnumeric and other parts correctly.
So it's assumed that Gnumeric needs some code conversion
depending on the charset of the current locale.

Looks like #120124, but I can't find where to be fixed.
Other gnome app with --help option strings translated
, if exists, might help...
Comment 1 Morten Welinder 2003-08-19 19:37:48 UTC
Could you tell me a sample English text that is, if I understand the
issue correctly, first translated into Japanese/UTF-8 and then printed
using printf (or equivalent)?
Comment 2 ynakai 2003-08-20 10:40:51 UTC
I can't see your points. 
(maybe because of my first explanation is not good.. ;-(  )

I attach 2 screenshots for easy undestanding...
Both are the results of 'gnumeric --help', but
one is on LANG=ja_JP.UTF-8 environment and other is LANG=ja_JP.eucJP
env.
Comment 3 ynakai 2003-08-20 10:43:36 UTC
Created attachment 19375 [details]
LANG=ja_JP.eucJP : Gnumeic part ('Application options') is unreadable while GTK+ part shows sane Japanese
Comment 4 ynakai 2003-08-20 10:44:45 UTC
Created attachment 19376 [details]
LANG=ja_JP.UTF-8 : Gnumeric part shows sane Japanese texts too.
Comment 5 ynakai 2003-08-20 10:54:30 UTC
Created attachment 19377 [details]
Sample test case for discussion
Comment 6 ynakai 2003-08-20 10:58:23 UTC
The above small test case (main.c) simulates 'gnumeric --help' behavior.

I've found undocumented popt option 'POPT_ARG_INTL_DOMAIN' in
libgnome-2.2.0.1/libgnome/gnome-init.c.
Adding POPT_ARG_INTL_DOMAIN line takes effect for this test case,
but not for Gnumeric.
Comment 7 ynakai 2003-08-20 11:30:12 UTC
Ah, I've found just deleting bind_textdomain_codeset() line in
libgnumeric.c will solve this problem. POPT_ARG_INTL_DOMAIN doesn't
seem to affect.

But bind_textdomain_codeset() line is said what we always need for
GNOME2. Hmm...
Comment 8 ynakai 2003-08-21 08:24:11 UTC
I've found a fix. The diff is attached.

gettext detects the best charset for its output
in this order (see loadmsgcat.c, localcharset.c):
1. codeset specified with bind_textdomain_codeset()
2. OUTPUT_CHARSET environment value
3. nl_langinfo(CODESET) or charset alias guess from locale name

We need to use bind_textdomain_codeset(PACKAGE, "UTF-8")
to fix the gettext output code ( and then, input code to GTK+2 )
to UTF-8. But this is just for GTK+2 GUI, not for terminal messages.

We should not fix the output code as UTF-8 before the arg-parse
with popt, so that gettext can decide it naturally according to
nl_langinfo() or the current locale name, which is also the
users' terminal can shows up correctly.

The patch will delay bind_textdomain_codeset() until
the argument parsing is finished. (setlocale(), bindtextdomain(),
textdomain() should still be before the argument parsing)
Comment 9 ynakai 2003-08-21 08:25:24 UTC
Created attachment 19401 [details] [review]
The patch to delay bind_textdomain_codeset() until argparse ends up.
Comment 10 Jody Goldberg 2003-08-21 13:51:44 UTC
I had a feeling it would be something like this.  I've committed a
variant of the patch that will work for the bonobo component too.