#179 Handling of locale (LC_*) is wrong

closed
nobody
other (39)
5
2008-10-25
2006-10-06
Anonymous
No

Hi,

I'm using joe 3.5 on FreeBSD 6.2. I often have
to edit texts that contain German umlauts, so
I set LC_CTYPE=de_DE.ISO8859-15. On the other
hand, I do not want German messages printed by
programs, instead I want the usual English
interfaces. So I do not set LC_MESSAGES or
any other LC_* or LANG variables, only LC_CTYPE
as explained above.

However, joe doesn't work correctly, it seems
to look only at LC_CTYPE in order to decide
that German messages should be used. Even if
I set LC_MESSAGES=C and LANG=C explicitely, it
is ignored. If I set LC_ALL=C, then English
messages are used, _but_ then the German umlaut
characters don't work correctly, because LC_ALL
overrides everything else, including LC_CTYPE.

I'm sorry I don't have a source code patch
ready for inclusion, but it shouldn't be hard
to fix the problem.

Summary: LC_CTYPE should be used for the type
of the character set. LC_MESSAGES should be
used for the message catalog, i.e. the language
of strings. If LANG is set, it should be used
as a default for other LC_* variables that are
not set. And if LC_ALL is set, it overrides
everything else, no matter if set or not.

Well, at least that's how it is documented in
the setlocale() manpage and in SUSv3/POSIX,
and all other programs behave like that. :-)

Best regards
Oliver <olli@fromme.com>

Discussion

  • Nobody/Anonymous

    Logged In: NO

    In utf8.c the following code should be changed so that each !s is changed to a !s || !*s . This is used elsewhere in the same file but not here for some reason.

    An empty LC_ string is as indicative of no value as a non-existant string.

    343 void joe_locale()
    344 {
    345 unsigned char *s, *t, *u;
    346
    347 s=(unsigned char *)getenv("LC_ALL");
    348 if (!s) {
    349 s=(unsigned char *)getenv("LC_CTYPE");
    350 if (!s) {
    351 s=(unsigned char *)getenv("LANG");
    352 }
    353 }
    354

     
  • Joe Allen

    Joe Allen - 2008-10-25

    This is now fixed in CVS. JOE looks at LC_ALL/LC_MESSAGES/LANG for the language to use for editor messages, but LC_ALL/LC_CTYPE/LANG for the character set.

     
  • Joe Allen

    Joe Allen - 2008-10-25
    • status: open --> closed
     
  • Joe Allen

    Joe Allen - 2008-10-25

    This is now fixed in CVS. JOE looks at LC_ALL/LC_MESSAGES/LANG for the language to use for editor messages, but LC_ALL/LC_CTYPE/LANG for the character set.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks