Display Chinese from Unicode using FPDF

I need some help. In our DB we have some chinese characters that look like this 红 and when put on a web page it look just like a Chinese character.

We need this to happen in a PDF using FPDF. In the FPDF example for displaying Chinese characters he gives this example...

$pdf=new PDF_Chinese();
$pdf->Write(10,'²{®É®ð·Å 18 C Àã«× 83 %');

What I need to know, is how I can convert this (红) to this format (®É®ð·Å 18 C Àã«× 83 %). If I can get it in that format then I think I can get it to display Chinese in our PDF.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Well, I don't know Chinese, so I don't really have any way to check this, but I tried it, and it at least made a PDF with a chinese character in it:

1) Copy this function to your file, call it test.php: http://codes.myfreewares.com/php/Unicode/utf8Encode.php-file.html

2) copy the FPDF_Chinese class from here:

and save it to a file Chinese.php. Change the first line require_once ('Fpdf.php');  to require_once ('fpdf.php'); and put it in your FPDF folder along with fpdf.php, fonts, etc...

3) in your test.php do this:

$a =utf8Encode('红');

define(FPDF_FONTPATH,'/path/to/FPDF/font/');  //note trailing slash

$pdf=new FPDF_Chinese();
$pdf->Output('test.pdf', 'F');

This will create a file test.pdf with a single Chinese character in it. The right one? I have no idea -- you'll have to tell me :) I will say it doesn't look like the one displayed in my browser by 红 but I'm not sure if that makes it wrong or not...

Hope this helps...if not, I'm sorry to say that I'm out of ideas....

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chadsaunAuthor Commented:
That did work Matt. Thanks. Now we just need to get our translator and figure out if it echo'd the right character :P
Hi!  Does anyone still have the file "http://codes.myfreewares.com/php/Unicode/utf8Encode.php-file.html."  

I, too, am trying to get PDF to display chinese characters...

Thanks for your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.