SourceForge has been redesigned. Learn more.

#2 further locale patch for the asis option



One of the biggest problems of joe is the '-asis'
option. Without this you cannot see the ISO-8859-x
accented characters, which are probably needed for all
the non-English speaking users. With the '-asis' option
turned on if you accidentally try to edit a binary file
that fucks up your terminal. The nice solution would be
kind of printing directly the characters >=160, and
handling chars 128-159 the other way.

The patch I attach for the 2.9.6 version to solve this
problem is based on the SuSE-7.1 version of Joe-2.8.
With the -asis option everything is printed as is,
without this option all the printable characters are
printed, not only those below 128.

Note that once this patch is used, the default joerc
file should be changed not to use -asis, as this you
may notice in the patch itself, and this is something
people at SuSE unfortunately forgot about.

There's a very ugly part of the patch, that is patching
main.c. The reason for this is that the default C or
POSIX locales mark all the characters above 127 as
non-printable. Therefore people not having a correctly
set up LANG or at least LC_CTYPE would be unable to see
accented characters without this ugly hack, and this is
probably not what we want. This hack sets the CTYPE
locale to en_US in case it has the value C or POSIX.
Another, maybe even much more uglier solution would be
to edit scrn.h to something like this: #define
xlat(a,c) .... (isprint(c) || c>=160 ||

In a correct world every user would have a LC_CTYPE and
so we wouldn't need this really ugly hack. But the
world is not correct, or at least we shouldn't rely on
it, therefore I think we must somehow help people to
easily use JOE without knowing anything of locales,
make JOE even much better :-)

Of course if you prefer the second solution or another
ugly hack (or maybe an elegant way) to this problem,
it's up to you Marek, I just hope that you agree with
that the goals described above and will patch Joe to
meet these goals.



  • Vitezslav Samel

    Vitezslav Samel - 2001-12-17
    • status: open --> closed

Log in to post a comment.