From:             [EMAIL PROTECTED]
Operating system: Linux Redhat 7.2
PHP version:      4.3.0
PHP Bug Type:     *Languages/Translation
Bug description:  XML parsing and strtoupper broken in Turkish

I was trying to do some XML-RPC stuff in PHP while my locale was set to
'tr_TR.utf8'. I (and others) have reported other bugs related to Turkish
and PHP because of the odd Turkish relationship with the letter "i".

While issues related to the lower-casing of object classes have been
resolved in 4.3.0, I encountered similar problems with XML parsing.

Specifically, when the locale is set to "tr_TR.utf8' and an xml parser is
created with CASE_FOLDING enabled, "INT" tags and "STRING" tags are labels
as "iNT" and "STRiNG". Consequently, functions designed to recognize tag
names based on all uppercase letters fail to recognize these tags.

The problem is also evident in the basic strtoupper function built into
PHP. The following code demonstrates both examples:

<?
putenv("LANG=tr_TR.utf8"); 
$chk = setlocale(LC_ALL,'tr_TR.utf8');
if ($chk) echo ("Setting language to Turkish<br>\n");

$x = "<string>foo</string>";
echo ("x is ".htmlspecialchars($x,ENT_COMPAT,'utf-8')."<br>\n");
$y = strtoupper($x);
echo ("Strtoupper yields
".htmlspecialchars($y,ENT_COMPAT,'utf-8')."<br>\n");

function startElement($parser, $name, $attrs) {
    print "Start tag name: $name<br>\n";
}

function endElement($parser, $name) {
    print "End tag name: $name<br>\n";
}
function charData($parser, $data) {
    print "Character Data: $data<br>\n";
}

$parser = xml_parser_create('utf-8');
xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,true);
xml_set_element_handler($parser, "startElement", "endElement");
xml_set_character_data_handler($parser, "charData"); 
echo ("Parsing with utf-8 parser, case_folding enabled<br>\n");
xml_parse($parser,$x);
xml_parser_free($parser);
?>
-- 
Edit bug report at http://bugs.php.net/?id=22003&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22003&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22003&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22003&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22003&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22003&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22003&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22003&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22003&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22003&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22003&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22003&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22003&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22003&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22003&r=gnused

Reply via email to