FPDF和欧元符号存在问题 [英] Problems with FPDF and Euro symbol
问题描述
我花了几天的时间筛选各种方法,以鼓励FPDF渲染欧元符号,但没有一个成功.我有:
I've spent a couple of days sifting through various methods to encourage FPDF to render the Euro symbol, but none have succeeded. I have:
$currency = iconv("UTF-8", "ISO-8859-1//TRANSLIT", '€');
这将导致:
iconv()[function.iconv]:检测到不完整的多字节字符 在输入字符串中
iconv() [function.iconv]: Detected an incomplete multibyte character in input string
我尝试了多种编码类型,但无济于事.
I've tried a variety of encoding types, but to no avail.
推荐答案
您实际上可以使用带有欧元ascii代码的chr(128)
的FPDF生成带有欧元符号的PDF.
You actually can generate a PDF with euro signs using FPDF with using euro ascii code: chr(128)
.
这是一个常数,这是一个好习惯.在脚本顶部,添加:
It's good practice to make this a constant. At the top of your script, add:
define('EURO',chr(128));
现在,您可以在脚本中使用EURO
来打印欧元符号.
例如:
Now you can use EURO
in your script to print the euro symbol.
For example:
"Costs: ".EURO.100
将输出:Costs: €100
注意:这对于具有chr(ascii)
的其他符号也适用,其中ascii
是该符号的ascii代码.您可以在以下页面上找到ASCII代码的概述:http://www.atwebresults.com/ascii-codes.php?type=2
Note: This will also work for other symbols with chr(ascii)
, where ascii
is the ascii code of the symbol. You can find an overview of ascii codes on this page: http://www.atwebresults.com/ascii-codes.php?type=2
这篇关于FPDF和欧元符号存在问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!