Page 1 of 1

Please confirm: output control and unicode encoded files

Posted: Thu Dec 11, 2003 5:17 am
by donandre
Hi!

I have experienced that php does not properly handle unicode encoded files. When I write a php script with some unicode characters and save it in unicode mode then apparently there are some characters preceding the content of the files (probably to inform that this file is unicode encoded). Php however interprets this characters as output and sends them to the browser.

So if you have:

Code: Select all

<?php
setcookie("somecookie",1,time()+10000,"/",$_SERVER["SERVER_NAME"],0);

if ($_COOKIE["somecookie"])
  echo "success";
else
  echo "failure";
?>
and you save that unicode encoded then setcookie will not work and you'll always get a warning that headers already been sent and failure is always printed out.

I only have php 4.2 or so, can someone confirm this behaviour is still there in the newest version of php?

Because Id like to file a bug report. Or if someone else wants to do, please feel free.... just do a notice here.

Don

Posted: Fri Dec 12, 2003 6:54 am
by donandre
hmm okay I tested it myself (installing php4.3 on windows *sweat*),

Conclusion: 4.3 doesnt seem to show this behaviour