From:             js at mcs dot be
Operating system: Windows XP
PHP version:      5.2.9
PHP Bug Type:     COM related
Bug description:  COM automation: garbled utf-8 text

Description:
------------
When using the attached script (saved as UTF-8 without BOM) to generate a
word document, at the end of the text typed programmatically into word a
"ÿ" character gets added. This character is only visible if I press the
inverted "P" button on the toolbar. This is a reduced test case, but in
real-world scenarios, visibly garbled text is inserted into word.

Reproduce code:
---------------
<?php
   unlink(dirname(__FILE__)."\\test.doc");
   $word = new COM("word.application", NULL, CP_UTF8);
   $word->Visible = false; // hidden
   $word->Documents->Add();
   $word->Selection->TypeText("This is a tést...");
   $word->Documents[1]->SaveAs(dirname(__FILE__)."\\test.doc");
   $word->Quit();
   $word = null;
   header("Content-type: text/plain");
   echo "wrote file to ".dirname(__FILE__)."\\test.doc";
?>

Expected result:
----------------
The COM automation should accept UTF-8 formatted PHP strings without
malforming the string ending when the CP_UTF8 parameter is added.

Actual result:
--------------
Broken characters at the end of every string containing non-ASCII
characters sent via COM automation.

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

Reply via email to