From: xpower dot ltd at gmail dot com
Operating system: Windows Server 2008
PHP version: 5.2.6
PHP Bug Type: *Unicode Issues
Bug description: Win.Srv'08 + IIS7 + PHP 5.2.6 + MySQL 5
Description:
------------
Writing file somehow messed up XML encoding ?
if we disable the part :
$myFile = "file.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh,$sql);
fclose($fh);
then it is O.K. but else the encoding is messed up.
Reproduce code:
---------------
header("Content-type:text/xml");
iconv_set_encoding("internal_encoding", "UTF-8");
iconv_set_encoding("output_encoding", "UTF-8");
...
...
$sql = "SELECT id,name,in_egn,phone,mobile,city FROM contragents
".loadRole('')." name!='' and type='".iconv("UTF-8",
"UTF-8",$_GET['sort'])."' ";
$sql.= "ORDER BY ".$_GET["orderBy"]." ".$_GET["direction"]."";
$sql.= " LIMIT ".$posStart.",".$count;
$myFile = "file.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh,$sql);
fclose($fh);
$res = mysql_query ($sql);
...
...
print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
if($res)
{
print("<rows total_count='".$totalCount."' pos='".$posStart."'>\n");
for($i=0;$left= mysql_fetch_array($res);$i++)
Expected result:
----------------
expected UTF-8 getting something else ?
Actual result:
--------------
about the iconv("utf-8","utf-8"... Vista localized versions have some
encoding problems of it own, so thats a fix for that...
--
Edit bug report at http://bugs.php.net/?id=45332&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45332&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45332&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45332&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45332&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45332&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45332&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45332&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45332&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45332&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45332&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45332&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45332&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45332&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45332&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45332&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45332&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45332&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45332&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45332&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45332&r=mysqlcfg