'TCPDF unable to handle “\00a0” unicode character non breakable space
I am converting an HTML string to PDF. The HTML string has a Unicode character \00a0
non breakable space. In the PDF, \00a0
is converted in to ;Â
symbols.
Below is the code
$pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'UTF-8', false);
$pdf->AddPage();
$pdf->SetFont('helvetica', '', 11, '', true);
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->Ln(2);
$pdfDoc = $pdf->Output("doc.pdf", "F");
Please help.
Solution 1:[1]
UTF-8 U+00A0
string is 1100 0010 1010 0000
in binary (C2 A0
in hex).
Similarly, Latin-1 (ISO_IEC 8859-1) Â
string is 1100 0010 1010 0000
in binary too.
I think that your converter read that UTF-8 html file as Latin-1.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |