<<< Date Index >>>     <<< Thread Index >>>

Re: national chars - libiconv not used?



Hello Michal,

 On Tuesday, June 20, 2006 at 11:08:34 +0200, Alain Bench wrote:

> [checklocale] This 852 locale works very well...

    Perhaps wide functions or type conversions fail. Could you please
try the attached test? In your locale it should give something as:

| $ ./iswprint81
| isprint(129) = 1
| iswprint(129) = 0
| mbrtowc returns 1, and converted char 0x81 to wc U+00FC
| iswprint(252) = 1

    Where the char coded 0x81 in CP-852 is the printable 'ü' u umlaut
U+00FC. I fear it may be considered as in HP-ROMAN8 the non-printable
control char U+0081.


Bye!    Alain.
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
#include <stdio.h>
#include <locale.h>
#include <ctype.h>
#include <wctype.h>
#include <wchar.h>


int main(void)
{
        unsigned char c = 129;
        char mbstring[42] = " ";
        wchar_t wc;

        setlocale(LC_ALL, "");

        printf("isprint(%d) = %d\n", (int)c, isprint((int)c));
        printf("iswprint(%d) = %d\n", (int)c, iswprint((wint_t)c));

        mbstring[0] = (char)c;
        printf("mbrtowc returns %d, ", mbrtowc(&wc, mbstring, 
sizeof(mbstring)-1, NULL));
        printf("and converted char 0x%02X to wc U+%04X\n", (int)c, (int)wc);

        printf("iswprint(%d) = %d\n", (int)wc, iswprint((wint_t)wc));

        return(0);
}