Forum


Replies: 5   Views: 3057
Utf-8 and language
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by bernhardh  · 06-06-2012 - 11:03

Hello,

I have made a test document.php:

[code]
require_once '../phpdocx/classes/CreateDocx.inc';

$docx = new CreateDocx();
$docx->setEncodeUTF8();
$docx->setLanguage("de-DE");
$text = 'Ü - ä - ßberschrift Lorem ipsum dolor sit amet, consectetur adipisicing elit';

$paramsText = array(
'b' => 'single',
'font' => 'Arial'
);
$docx->addText($text, $paramsText);
$docx->createDocx('example_text');
[/code]

The file is saved as UTF-8.

But the created Docx has wrong letters in it:

[code]
Ü - ä - ß - Ö - berschrift Lorem ipsum dolor sit amet, consectetur adipisicing elit
[/code]

Posted by admin  · 11-04-2013 - 12:13

Hello,

If you are using an UTF8 editor, please remove $docx->setEncodeUTF8(); line.

Regards.

Posted by bernhardh  · 11-04-2013 - 12:13

Thanks, it works...

Posted by bernhardh  · 11-04-2013 - 12:13

Ok, we have now bought pro version and if we use umlauts in addText it works, but if we use the same string in addHTML we get wired symbols??

Posted by bernhardh  · 11-04-2013 - 12:13

Ok, i solved the problem myself...
I have to use a full html structure including <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> and not only some html snippets..