Re: [htdig] french accents


Subject: Re: [htdig] french accents
From: Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Date: Wed Jan 26 2000 - 07:31:30 PST


According to Torsten Neuer:
> Eric Litot wrote:
> > So since I'm not very fond of the configuration aspects of the server on
> > which I want to set-up the htdig package, what would be the best way where I
> > could investigate ? The trouble is that at the moment, I can't answer to my
> > users about the availability of the search engine.
>
> Have a look at the locale database directory itself (usually this is
> "/usr/lib/locale" or "/usr/share/locale") and check the definitions
> for the locale setting of your choice.
>
> If the definitions are missing, try to create them with the localedef(8)
> program. Else, there might be an error in the locale support of your C
> library (you might need to write a little test program to check that
> out).

Here's one I wrote a little while ago, which will show you the ctype map
for the entire character set, as it appears for your locale. If it shows
all of the upper-half of the character set as control characters (c),
rather than some alphabetic characters (A with u or l), then you have a
problem with your locale. You can try various locales using a command
line argument. If you find one that works, try changing the LC_CTYPE
to LC_ALL in the setlocale() call, to make sure it still works that way.
If it works both ways, that locale should work with htdig.

If you can't find a locale that works, and you can't get anything
to work even if the locales are fully installed, then it may be that
locale support in your C library is broken. I know from experience
that locale support in libc-5.3.12 on my Red Hat 4.2 Linux system does
not work, and I wouldn't expect much from any libc5 based Linux system.
(I have yet to see a counter-example of this posted on this list.)
On the other hand, glibc 2.0 & 2.1 based Linux systems (e.g. Red Hat
5.x & 6.x) seem to have proper locale support.

-------- 8< -------- 8< --------
#include <ctype.h>
#include <locale.h>

main(int ac, char **av)
{
        int i;
        unsigned char c;

        if (ac > 1) setlocale(LC_CTYPE, av[1]);

        for (i = 0; i < 256; ++i) {
                printf("%3d 0x%02X: ", i, i);
                c = i;
                if (isprint(c))
                        printf(" %c", c);
                else if (c < 0x80 && isprint(c ^ '@'))
                        printf("^%c", c ^ '@');
                else if (isprint((c & 0x7F) ^ '@'))
                        printf("~%c", (c & 0x7F) ^ '@');
                else
                        printf(" ");
                printf(" %c%c%c%c%c%c%c%c%c%c%c%c%c\n",
                        isascii(c) ? 'A' : '-',
                        isalpha(c) ? 'a' : '-',
                        islower(c) ? 'l' : '-',
                        isupper(c) ? 'u' : '-',
                        isalnum(c) ? 'n' : '-',
                        isdigit(c) ? 'd' : '-',
                        isxdigit(c) ? 'x' : '-',
                        isgraph(c) ? 'g' : '-',
                        isprint(c) ? 't' : '-',
                        ispunct(c) ? 'p' : '-',
                        iscntrl(c) ? 'c' : '-',
                        isspace(c) ? 's' : '-',
#ifdef isblank
                        isblank(c) ? 'b' : '-'
#else
                        '?'
#endif
                        );
        }
}
-------- 8< -------- 8< --------

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------ To unsubscribe from the htdig mailing list, send a message to htdig-unsubscribe@htdig.org You will receive a message to confirm this.



This archive was generated by hypermail 2b28 : Wed Jan 26 2000 - 07:33:06 PST