【问题标题】:iconv(): Detected an illegal character in input string in FPDF for Turkish charactersiconv():在 FPDF 的输入字符串中检测到土耳其字符的非法字符
【发布时间】:2020-11-16 07:10:48
【问题描述】:

我得到一个错误 -> iconv(): Detected an invalid character in input string in

这是我的代码:

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();

这是我看到的:

致命错误:未捕获异常:FPDF 错误:一些数据已输出,无法在 C:\xampp\htdocs\test4\islemler\fpdf\fpdf.php 中发送 PDF 文件:271 堆栈跟踪:#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} 在 C:\xampp\ htdocs\test4\islemler\fpdf\fpdf.php 在第 271 行

【问题讨论】:

  • 这是因为 ₺ 符号。当我删除该符号时,它已修复。

标签: php pdf fpdf


【解决方案1】:

试试

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

【讨论】:

    猜你喜欢
    • 2014-08-16
    • 2012-02-02
    • 2012-08-08
    • 2016-10-09
    • 1970-01-01
    • 1970-01-01
    • 2012-05-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多