简体   繁体   中英

iconv(): Detected an illegal character in input string in FPDF for Turkish characters

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

Try

function turkce($k)
{
    return iconv('utf-8','iso-8859-9\\TRANSLIT',$k);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM