FPDF和欧元符号存在问题 [英] Problems with FPDF and Euro symbol

查看:110
本文介绍了FPDF和欧元符号存在问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了几天的时间筛选各种方法,以鼓励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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆