ID: 32958
Updated by: [EMAIL PROTECTED]
Reported By: kirchner at cm-sec dot cz
-Status: Open
+Status: Feedback
Bug Type: Strings related
Operating System: Linux Debian
PHP Version: 4.3.10
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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