简体   繁体   中英

PHP FPDF doesn't display certain UTF-8 decoded special characters correctly

I'm trying to display MySQL utf8_general_ci encoded texts in fpdf by using PHP's utf8_decode . Everything worked as expected, but when our customer entered his texts, every ü showed up as u? etc.

The problem is that I can't tell the difference between his ü and mine. Both show up fine in phpMyAdmin or our CMS. Once I replace his ü with one typed by me it works.

What's the hidden difference here?

So our client entered his texts copied from Word. I exported the table and opened it with a text editor. My ü was fine and his ü was only the canonical equivalent . I suspect utf8_decode can't handle that and just returned u? . This also explains why the error didn't show up anywhere else.

试试这个代码

iconv('UTF-8', 'windows-1252', value)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM