|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-03-02 13:24 UTC] moriyoshi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 15:00:01 2025 UTC |
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); ?>