Steffen
Steffen

Reputation: 1576

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?

Upvotes: 0

Views: 1772

Answers (2)

James
James

Reputation: 262

Try this code

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

Upvotes: 0

Steffen
Steffen

Reputation: 1576

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.

Upvotes: 1

Related Questions