From:             hunt_inet at yahoo dot com
Operating system: WinXP sp3 (Chinese traditional)
PHP version:      5.2.10
PHP Bug Type:     Output Control
Bug description:  command line output problem

Description:
------------
I faced some problem to correctly output text from php command line file.
So I wrote a samll test and save it as "hello.php" as the code listed
below.

If I saved it in UTF-8 format and executed it in the command line, then it
output some garbage (chinese part) and part of correct text (English part).
 But if I ran it in browser, the output is correct.

Also, if I save it in ANSI format (I believe it is in multi-byte format)
then the output is correct in command line. But its output is some garbage
(chinese part) in browser view.

I guess this is a bug.

Hunt Chang

Reproduce code:
---------------
<?php
//      cause this file is saved in UTF-8 format
setlocale(LC_ALL, 'zh_TW.UTF8');                // warning: not 'UTF-8'!
//      setlocale(LC_ALL, 'zh_TW');             // warning: not 'UTF-8'!

//      You may execute this script by typing:
//      php hello_cmd.php
print "Hello world!\n";
echo  "Hello world!\n";
echo  '歡迎光臨!' . "\n";
echo  "歡迎光臨!\n";
?>




-- 
Edit bug report at http://bugs.php.net/?id=48891&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48891&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48891&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48891&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48891&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48891&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48891&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48891&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48891&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48891&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48891&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48891&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48891&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48891&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48891&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48891&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48891&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48891&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48891&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48891&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48891&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48891&r=mysqlcfg

Reply via email to