Bug #47984 [Opn->Nab]: COM automation: garbled utf-8 text

From: Date: Tue, 07 Apr 2015 14:48:10 +0000
Subject: Bug #47984 [Opn->Nab]: COM automation: garbled utf-8 text
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191875@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=47984&edit=1

 ID:                 47984
 Updated by:         cmb@php.net
 Reported by:        js at mcs dot be
 Summary:            COM automation: garbled utf-8 text
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            COM related
 Operating System:   Windows XP
 PHP Version:        5.2.9
 Block user comment: N
 Private report:     N

 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

As amoeba had pointed out: duplicate of bug #37899.


Previous Comments:
------------------------------------------------------------------------
[2009-09-09 13:39:14] ameoba32 at gmail dot com

This bug is known for ages. Here is duplicate 

http://bugs.php.net/bug.php?id=37899

even patch is available. I have patched php 5.2.3 and it works fine.

How to fix this in upcoming release ?

------------------------------------------------------------------------
[2009-04-16 09:22:47] js at mcs dot be

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 this bug report at https://bugs.php.net/bug.php?id=47984&edit=1


Thread (6 messages)

« previous php.bugs (#191875) next »