|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40355 the dcom interface doesn't support the utf8 encoding
Submitted: 2007-02-04 19:45 UTC Modified: 2007-02-05 12:22 UTC
From: info at paolotozzo dot it Assigned:
Status: Not a bug Package: COM related
PHP Version: 5.2.0 OS: WINDOWS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
46 - 25 = ?
Subscribe to this entry?

 [2007-02-04 19:45 UTC] info at paolotozzo dot it
I try to test this bug with the MS Word application, with MS Excel and with Adobe Indesign application, but I suppose that also with other applications the result is the same.
If I insert (with COM interface) a text with non standard encoding (like russian language , greek language etc.), I get always strange output. I try to change all the settings in php.ini, I try to use the mbstring and the iconv functions, but the result is the same:
1) I get the '?' symbols
2) I get the strange output

The file .php that I use for test is saved correctly in utf-8 format
I.E. I put a greek text in a variable..if I write this variable in a text file, it work well, but If I use this var for print an output with a com interface, it doesn't work.
I try this with all the last php versions.

Reproduce code:
// create a reference to a new COM component (Word)
$word = new COM("word.application") or die("Can't start Word!"); 

// print the version of Word that's now in use
echo "Loading Word, v. {$word->Version}<br>"; 

// set the visibility of the application to 0 (false) 
// to open the application in the forefront, use 1 (true)
$word->Visible = 1; 

// create a new document in Word

// add text to the new document

//in the next line I assign at $text var a greek text string

//i try to use the mb, with many combinations of encoding
//but the result is the same if I comment this line
$text=mb_convert_encoding($text, '', "UTF-8");

//I try to write the var in a text file, and it works well


//save the document in the Windows temp directory

// print another message to the screen
echo "Check for the file..."; 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-05 12:22 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

I think the problem here is simply that you have not specified which codepage COM is to use to use when
processing strings. This is done via the "codepage" argument
when you instantiate the COM object. You need something

      word = new COM("word.application", NULL, CP_UTF8) 

The default is to use the ANSI code page (CP_ACP).
See for further details.

If the problem still persists re-open the defect and I will investigate further.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Nov 29 15:01:28 2023 UTC