fpdf 中导出的符号错误... ñ作为ñ ..?
我不知道问题是什么,但每当我从 $_POST 函数调用字母 ñ 时,它就会将其作为 ñ 放入我的 fpdf 中。知道为什么吗?
I dont know whats the problem but whenever I call the letter ñ from $_POST function it puts it in my fpdf as ñ .. any idea why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您的字符串编码错误。它是 UTF-8 但我认为你需要 Latin-1 左右..
你可以在你的字符串上使用 utf8_decode() :
Your string has a wrong encoding. It's UTF-8 but I think you need Latin-1 or so..
You can use utf8_decode() on your strings:
我也花了相当多的时间试图让它发挥作用,并认为以下解释可能对其他人有帮助。
如果唯一的问题是
£/€
或类似字符,则无需编写自己的复杂函数。这是我使用过的内容(取自此线程和网上的其他线程):-
效果不错,但一定记得在与
utf8_decode();
相同的行,否则就会搞砸!希望这对像我一样挣扎了几个小时的可怜的草皮有所帮助!
I too have spent a fair amount of time trying to get this to work and thought the following explanation might be helpful for others.
No need to write your own complex functions if the only problem is a
£/€
or similar character.Here's what I have used (taken from this thread and others on the net):-
Works a treat but do remember to do the
number_format($yourval, 2)
in the same line as theutf8_decode();
or it screws up!Hope this is helpful to some poor sod, who like me, has struggled for a few hours!
另一种解决方案是使用 Unicode (UTF-8) 支持来扩展 FPDF。有一个补丁: http://acko.net/node/56
The alternative solution would be to extend FPDF with Unicode (UTF-8) support. There is a patch for that: http://acko.net/node/56
我们曾经遇到过这个问题,并使用
解决了问题(当然取决于数据是否来自用户、数据库……)。不要忘记在标头中以 UTF-8 格式将文件传递给用户
We had the problem once and using
solved the problem (depends of course if the data is comming from the user, a database,...). Don't forget to deliver the file to the user in UTF-8 as well in the header