Tuesday, August 31, 2010

FPDF °C become °C

Keyword
FPDF °C become °C
FPDF °C problem
FPDF symbol problem
FPDF degree celsius temperature problem

I having a bug when I create a file from FPDF the character when wrong.
The wrong is the symbol where °C become °C

I try to change the FPDF font into UTF-8 by embedding UTF-8 font into it but still problem (my database and html page display the °C correctly)

after several experimenting cause googling is failed (4 hours of stress)
the reaseon is because of my page encoding. FPDF write into the paper using 'ISO-8859-1' encoding.
Thus UTF-8 is °C and when it write it become ISO-8859-1 which is °C

So long for the chatting lets cut to the point

use utf8_decode("°C") will solve your problem. It will convert UTF-8 to ISO-8859-1

HOpe this help cause 'quick googling' disappoint me

Just for my own reference to converting string

2 comments:

SheIsAGoodGirlCrazyAboutElvis said...

Thanks a lot for the solution. Saved my day. :)

Unknown said...

Thank you very much!