Ben Ben - 6 months ago 41
SQL Question

FPDF / mySQL : How to overcome encoding troubles with fpdf and mysql

To generate PDF's invoices I use

fpdf
lib and store repeating text in a
mySQL
DB.

When I store this text in a simple file I need to save it as Latin1 encoded due to the fact that
fpdf
uses Latin1/cp1252 encoding. This works so far.

But when I store it in a
mySQL
DB I get the typical
á日�
gibberish, no matter which collation I use for the text fields. In this case I set it to Latin1_general_ci. The server itself is generally set to UTF-8 Unicode.

There are several question to this issue:


  1. Does ist help to set the server also to Latin1 ?

  2. Does
    fpdf
    also render UTF-8 encoding character to overcome this issue ?

  3. Can I overcome this issue with
    tpdf
    rather than with
    fpdf
    ?



Any help to find the
one and only
solution is appreciated

UPDATE :

No answer frome no one ? Gibberish seems to be a unsolvable issue .. hm

Ben Ben
Answer

I answer the question myself because I found now a solution. If it is the one and only I doubt, but it is a solution for my approach.

Q&A

  1. Q: Does ist help to set the server also to Latin1 ?
    A: It should, but I had no success at all. Still this question is open.
  2. Q: Does fpdf also render UTF-8 encoding character to overcome this issue ?
    A: NO, not as far as I know. I spend some time to google, but found no hint, nor any concrete answer.
  3. Q: Can I overcome this issue with tpdf rather than with fpdf ?
    A: YES, it works perfect. Read here.
Comments