|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-09-09 13:39 UTC] ameoba32 at gmail dot com
[2015-04-07 14:48 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
[2015-04-07 14:48 UTC] cmb@php.net
[2022-03-26 05:05 UTC] giw42161 at uooos dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 07:00:01 2025 UTC |
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.