2011-10-24 127 views
0

我使用的是笨(PHP 5 ++)的DOMPDF库,万物的伟大工程,但显示PDF时,我仍然有重音chracters问题。DOMPDF PDF创建问题重音字符

它取代所有的A产地证电子ù等用奇怪的字符(非UTF8字符)。

的envoirment是全球UTF-8如何调试/解决方案的尝试为这个问题?

我试着在创建pdf之前通过php设置内容类型,但没有任何更改...然后我把pdf放在同一个html中保存在分贝,它看起来确定,重音字符都可以,所以这是一个主要的dompdf问题我认为,其中设置了一些奇怪的编码,我认为:P

任何人都可以帮助我调试和修复?

将帖子

这是PDF文档我创建的HTML例子。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> 
       <head> 
       <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” /> 
       <style type="text/css"> 
       body{margin:0 auto;padding:0px;font-size:10px;font-family:helvetica, sans-serif;} 
       #wrapper{margin:30px;} 
       #logo{margin:2px;background-image:url(http://localhost/img/logo.png);background-repeat:no-repeat;} 
       #ricevuta{font-weight:bold;margin-top:4px;padding:5px;font-size:14px;} 
       #order-n{color:#fff;padding:3px;font-weight:bold;background-color:#785a3b;} 
       #address-order{background-color:#ebe0d5;padding:5px;} 
       .h1-p{font-weight:bold;font-size:14px;margin:5px;} 
       table{width:100%;} 
       table tr{width:100%;padding:4px;} 
       .align-right{text-align:right;} 
       thead {background-color:#785a3b;color:#fff;font-weight:bold;} 
       #table-total{background-color:#ebe0d5;} 
       </style> 
       </head> 
       <body> 
       <div id="wrapper"> 
       <div id="logo"> 
        <img src="http://localhost/img/logo.png" /> 
       </div> 
       <div id="ricevuta"> 
       Ricevuta Ordine 
       </div> 
       <div id="order-n"> 
       ORDINE numero - <strong>1 - Data (15-08-2011)</strong> 
       </div> 
       <p class="h1-p">Indirizzo Spedizione</p> 
       <div id="address-order"> 
       <p> 
       <strong></strong><br> 
       <strong>sdfsdf sdfsd</strong><br> 
       sfgfdg (sdgfdg), Austria, 45666<br> 
       sdfsdf<br> 
       telefono fisso: <br> 
       telefono mobile: <br> 
       </p> 
       </div> 
       <p class="h1-p">Riepilogo Ordine</p> 
       <table> 
       <thead> 
       <tr> 
       <td><strong>Nome Prodotto</strong></td> 
       <td><strong>Codice Prodotto</strong></td> 
       <td><strong>Quantita</strong></td> 
       <td><strong>Prezzo</strong></td> 
       </tr> 
       </thead> 

        <tr> 
        <td>3423rf</td> 
        <td><strong># </strong></td> 
        <td><strong>2</strong></td> 
        <td><strong>29,70 euro</strong></td> 
        </tr> 
       </table> 
       <table id="table-total"> 
       <tr class="align-right"> 
       <td></td> 
       <td></td> 
       <td></td> 
       <td><strong>Sub-totale:</strong> euro 59,40</td> 
       </tr> 
       <tr class="align-right"> 
       <td></td> 
       <td></td> 
       <td></td> 
       <td><strong> Spedizione:</strong> euro 26,50</td> 
       </tr> 

       <tr class="align-right"> 
       <td></td> 
       <td></td> 
       <td></td> 
       <td><strong>Totale (tax,incluse):</strong> euro 85,90</td> 
       </tr> 
       </table> 
       </div> 
       </body></html> 
+0

http://code.google.com/p/dompdf/wiki/CPDFUnicode –

+0

不明白我是否需要通过shell命令运行或安装包,这样我就不会导致我在标准托管。也尝试启用UNICODE支持http://code.google.com/p/dompdf/wiki/CPDFUnicode#Configure_DOMPDF_for_Unicode_support,但它不起作用:(并且我也没有在文档中指定的文件中创建行DOMPDF_UNICODE_ENABLED :/我补充说,但没有和什么时候添加什么都没有改变:( – sbaaaang

+0

@MarcB好吧我更新了dompdf到最新版本和默认启用UNICODE SUPPORT,问题依然存在:(重音字符转换为非utf8字符:( – sbaaaang

回答

4

我路过$htmldompdf之前固定使用utf8_decode($html)我的问题。这意味着重音字符现在可以工作。

+1

很高兴为你工作。当在iso-8859-1中不能表示字符时,'utf8_decode()'可能会破坏文本,但是听起来好像你没有使用无法处理的字符。如果您需要再次尝试使用UTF8,稳定的0.6.0版本将在可用性和功能方面有重大改进。 – BrianS