mPDF Manual – mPDF Utilities

strcode2utf()

(htmltoolkit >=1.0)

strcode2utf – Convert HTML numerical entities to UTF-8 encoded string

Description

string strcode2utf ( string $text [, boolean $low ])

Returns a UTF-8 encoded string.

Parameters

$text

The input string, containing HTML numerical entities e.g. Ά or •

$low

Specifies whether to convert HTML numerical entities of ASCII characters (<128).

DEFAULT: TRUE

Values

TRUE: Convert all HTML numerical entities to UTF-8 characters

FALSE: Only convert characters above codepoint 127

Return value

Returns a UTF-8 encoded string.

Examples

Example #1

<?php

$mpdf = new mPDF();

$wm = strcode2utf("&amp;#1575;&amp;#1610;&amp;#1604;&amp;#1575;&amp;#1578; &amp;#1601;&amp;#1610;&amp;#1605;&amp;#1575; &amp;#1575;&amp;#1610;&amp;#1604;&amp;#1575;&amp;#1578; &amp;#1601;&amp;#1610;&amp;#1605;&amp;#1575;");

$mpdf->SetWatermarkText($wm);

$mpdf->showWatermark = true;

$mpdf->WriteHTML('
Hallo World
');

?>

See Also