Reputation: 1199
I have a string coming from MySql DB, encoded in utf8mb4. I am rendering a pdf with FPDF for PHP, and I tried to convert it with iconv:
iconv('utf8mb4', 'cp1252',$myString);
This fails telling me "Notice: iconv(): Wrong charset, conversion from utf8mb4' to
cp1252' is not allowed".
If I try with
iconv('utf-8', 'cp1252',$myString);
I get "Notice: iconv(): Detected an illegal character in input string".
Without iconv I get multiple ascii chars in place of special chars, and it is not fine.
Is there any way to output this value correctly?
Upvotes: 0
Views: 3123
Reputation: 1199
I tried, it did't work. I solved this by using a version of FPDF that allows utf8: TFPDF. It is fully retrocompatible, provided that you add its new font (ttf).
Upvotes: 0
Reputation: 757
try this one to IGNORE character which is not allowed in the charset
iconv('utf-8', 'cp1252//IGNORE',$myString);
Upvotes: 1