In my PHP project, I have a PDF on which I would like to output Russian text:
Это предложение на русском языке.
In my MySQL database I have a table with Russian data with utf8_unicode_ci
. Inside this table the Russian data is represented with unidentifiable chars, as follows:
Я дейÑтвую Ñкорее доверительно Ð
On my pdf, not the corresponding Cyrllic gets outputted, but these unidentifiable chars.
Here comes an excerpt of my FPDF code, please note the variable $myRussianSentence
at the end whose output is problematic:
$pdf=new FPDF();
$pdf->SetAutoPageBreak(false, 0);
$pdf->AddPage();
$pdf->SetTitle('My Title');
$pdf->SetAuthor('John Miller');
$pdf->SetLeftMargin(18);
$pdf->SetFont('times', 'B', 36);
$pdf->SetTextColor(0,0,0);
$pdf->Cell(174, 45, 'MY PDF', "", 1, "C");
$pdf->Ln(5);
$pdf->Image($strAdDeckLink, $x = 40, $y = 60, $w = 131, $h = 129, $type = '', $link = 'http://www.example.com', $align = '', $resize = false, $dpi = 96, $palign = '', $border = 0);
$pdf->Ln(130);
$pdf->SetFont('times', 'B', 24);
$pdf->Cell(174, 26, 'This is some text', "", 1, "C");
$pdf->Ln(5);
$pdf->SetFont('times', 'B', 32);
$pdf->Cell(180, 26, $myRussianSentence, "", 1, "C");
Doing var_export()
on the variable $myRussianSentence
shows the sentence in proper Cyrllic chars. However, on the PDF it is outputted as unidentifable chars as found in my database.
How do I achieve that proper Russian gets displayed on my PDF?