php - iconv(): Detected an illegal character in input string in FPDF for Turkish characters
Get the solution ↓↓↓I got an error -> iconv(): Detected an illegal character in input string in
This is my code :
require_once 'fpdf/fpdf.php';
$pdf = new FPDF();
$pdf->AddPage();
$pdf->AddFont('arial_tr','','arial_tr.php');
$pdf->AddFont('arial_tr','B','arial_tr_bold.php');
$pdf->SetFont('arial_tr','',14);
$pdf->Cell(55,5,turkce('Fatura no'),0,0);
$pdf->Cell(58,5,turkce(': A011241'),0,0);
$pdf->Cell(25,5,turkce('Tarih'),0,0);
$pdf->Cell(52,5,turkce(': 2020-16-11 12:47 AM'),0,1);
$pdf->Cell(55,5,turkce('Toplam Tutar'),0,0);
$pdf->Cell(58,5,turkce(': 1231 в‚є'),0,0);
$pdf->Cell(25,5,turkce('MГјЕџteri AdД±'),0,0);
$pdf->Cell(52,5,turkce(': TuДџrul YД±ldД±rД±m'),0,1);
$pdf->Line(10,30,200,30);
$pdf->Ln(30);
$pdf->Cell(55,5,turkce('ГњrГјn AdД±'),0,0);
$pdf->Cell(58,5,turkce(': Coca Cola '),0,1);
$pdf->Cell(55,5,turkce('Vergi OranД±'),0,0);
$pdf->Cell(58,5,turkce(': %18 '),0,1);
function turkce($k)
{
return iconv('utf-8','iso-8859-9',$k);
}
$pdf->Output();
This is what I see :
Fatal error: Uncaught Exception: FPDF error: Some data has already been output, can't send PDF file in C:\xampp\htdocs\test4\islemler\fpdf\fpdf.php:271 Stack trace: #0 C:\xampp\htdocs\test4\islemler\fpdf\fpdf.php(1060): FPDF->Error('Some data has a...') #1 C:\xampp\htdocs\test4\islemler\fpdf\fpdf.php(999): FPDF->_checkoutput() #2 C:\xampp\htdocs\test4\islemler\fpdf.php(39): FPDF->Output() #3 {main} thrown in C:\xampp\htdocs\test4\islemler\fpdf\fpdf.php on line 271
Answer
Solution:
Try
function turkce($k)
{
return iconv('utf-8','iso-8859-9\\TRANSLIT',$k);
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: mark bundle as not supporting multiuse
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.