Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixing chinese and arabic characters in the safe HTML node blocks PDF generation #14

Closed
SpyroTEQ opened this issue Dec 15, 2016 · 1 comment

Comments

@SpyroTEQ
Copy link

(I will report this in the new library, because I cannot open issues on the deprecated old one)

When mixing some RTL characters with some other UTF8 characters in the same HTML node, like when mixing Chinese characters and Arabic characters (嫀 ط), then TCPDF screams a notice and the PDF is not built.

This happens on latest 6.2 version of TCPDF (and on elder ones like 5.9), using PHP 5.6.25

Showcase:

set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__);
spl_autoload_register();
error_reporting(E_ALL);

$pdf = new TCPDF('P', 'mm', 'A4');

// This one works
//$string = "<span>&#23232;</span> <span>&#1591;</span>";
//
// This one fails
$string = "&#23232; &#1591;";

echo($string);
var_dump($string);

$pdf->AddPage();
$pdf->writeHTML($string);
$pdfContent = $pdf->Output('doc.pdf', 'S');
// Screams ( ! ) Notice: Undefined offset: 23232 in C:\wamp\www\TCPDF-master\include\tcpdf_fonts.php on line 2119

var_dump($pdfContent);

Result:
嫀 ط
C:\wamp\www\TCPDF-master\test-8576.php:16:string '嫀 ط' (length=16)

( ! ) Notice: Undefined offset: 23232 in C:\wamp\www\TCPDF-master\include\tcpdf_fonts.php on line 2119

And the PDF is not generated.

@nicolaasuni
Copy link
Member

This message is for another library.
This is the new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants