Problems with FPDF and Euro symbol

2019-03-19 10:57发布

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", '€');

Which results in:

iconv() [function.iconv]: Detected an incomplete multibyte character in input string

I've tried a variety of encoding types, but to no avail.

3条回答
Evening l夕情丶
2楼-- · 2019-03-19 11:09

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));

Now you can use EURO in your script to print the euro symbol. For example:

"Costs: ".EURO.100

Will output: Costs: €100

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

查看更多
3楼-- · 2019-03-19 11:18

I've searched for ages, and nothing worked - until I used this: utf8_encode(chr(128))

查看更多
仙女界的扛把子
4楼-- · 2019-03-19 11:29

if You Want to show this line "£4.30" just follow bellow

$text = chr(163); $pound = $text."4.30 p m";

Note: 163 = pound code;

查看更多
登录 后发表回答