#40355 [Opn->Bgs]: the dcom interface doesn't support the utf8 encoding
| From: | wharmby@php.net | Date: | Mon, 05 Feb 2007 12:22:02 +0000 |
| Subject: | #40355 [Opn->Bgs]: the dcom interface doesn't support the utf8 encoding | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108417@lists.php.net to get a copy of this message | ||
ID: 40355
Updated by: wharmby@php.net
Reported By: info at paolotozzo dot it
-Status: Open
+Status: Bogus
Bug Type: COM related
Operating System: WINDOWS
PHP Version: 5.2.0
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
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
like:
word = new COM("word.application", NULL, CP_UTF8)
The default is to use the ANSI code page (CP_ACP).
See http://uk2.php.net/manual/en/class.com.php for
further details.
If the problem still persists re-open the defect and I will investigate
further.
Previous Comments:
------------------------------------------------------------------------
[2007-02-04 19:45:58] info at paolotozzo dot it
Description:
------------
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
$word->Documents->Add();
// add text to the new document
//in the next line I assign at $text var a greek text string
$text="ÅëëçíéêÜ";
//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
$c=fopen("test.txt","w");
fputs($c,($text));
$word->Selection->TypeText($text);
//save the document in the Windows temp directory
// print another message to the screen
echo "Check for the file...";
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40355&edit=1