ID:               32958
 Updated by:       [EMAIL PROTECTED]
 Reported By:      kirchner at cm-sec dot cz
-Status:           Open
+Status:           Bogus
 Bug Type:         Strings related
 Operating System: Linux Debian
 PHP Version:      4.3.10
 New Comment:

Works fine for me.



Previous Comments:
------------------------------------------------------------------------

[2005-05-06 08:36:01] kirchner at cm-sec dot cz

Hello,
you can be right. I used your test program and output is:

0000000 0aa9
0000002

When I convert 0xaa9 to dec = 2729 and I write in Linux console
<Alt>+<2729> I obtain the same character like when I write here
<Alt>+<169>, which is dec from 0xa9. Both outputs are correct.

When I change "str[0] to "str[0] = 0x61;" (letter "a") in main function
of your program, I obtain 

0000000 0a41
0000002

Jan Kirchner

------------------------------------------------------------------------

[2005-05-05 20:21:44] [EMAIL PROTECTED]

Sounds like a locale bug to me.  Could you compile this test program?

#include <stdio.h>
#include <locale.h>

char *php_strtoupper(char *s, size_t len) {
    unsigned char *c, *e;

    c = s;
    e = c+len;

    while (c < e) {
        *c = toupper(*c);
        c++;
    }
    return s;
}

main(void) {
    char str[2];
    str[0] = 0xb9;
    str[1] = 0x0;
    setlocale(LC_ALL,"cs_CZ");
    puts(php_strtoupper(str,1));
}

Just save it to s.c, for example and type: make s
Then run it like this: ./s | od -x
And add the output here.
As far as I can tell 0xb9 gets uppercased to 0xa9 in 8859-2, so you
should be seeing an a9 there in the output if your system's locale is
working correctly.

------------------------------------------------------------------------

[2005-05-05 17:34:51] kirchner at cm-sec dot cz

Description:
------------
Functions "strtolower" and "strtoupper" do not convert some Czech
characters from 8859-2 charset. I tested it and I found, that these
functions do not convert characters "�"/"�", "�"/"�" and "�"/"�", but
other special Czech characters are converted correctly.
Remark:
We most often use two charsets in our country: ISO 8859-2 for Unix like
systems and CP1250 (windows-1250) for Windows systems. Special Czech
characters have the same hexadecimal value in both charsets except of
mentioned characters (�,�,�,�,�,�).

I thing, that my locale is set correctly. Here are three rows from
output of the phpinfo() function.

default_charset ISO-8859-2      ISO-8859-2
_ENV["LC_ALL"]  cs_CZ
_ENV["LANG"]    cs_CZ

Best regards


Jan Kirchner



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32958&edit=1

Reply via email to