%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
namespace Mpdf\Utils;
class UtfString
{
/**
* Converts all the &#nnn; and &#xhhh; in a string to Unicode
*
* @since mPDF 5.7
* @param string $str
* @param bool $lo
*
* @return string
*/
public static function strcode2utf($str, $lo = true)
{
$str = preg_replace_callback('/\&\#(\d+)\;/m', function ($matches) use ($lo) {
return static::code2utf($matches[1], $lo ? 1 : 0);
}, $str);
$str = preg_replace_callback('/\&\#x([0-9a-fA-F]+)\;/m', function ($matches) use ($lo) {
return static::codeHex2utf($matches[1], $lo ? 1 : 0);
}, $str);
return $str;
}
/**
* @param int $num
* @param bool $lo
*
* @return string
*/
public static function code2utf($num, $lo = true)
{
// Returns the utf string corresponding to the unicode value
if ($num < 128) {
return $lo
? chr($num)
: '&#' . $num . ';';
}
if ($num < 2048) {
return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
}
if ($num < 65536) {
return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
}
if ($num < 2097152) {
return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
}
return '?';
}
public static function codeHex2utf($hex, $lo = true)
{
$num = hexdec($hex);
if (($num < 128) && !$lo) {
return '&#x' . $hex . ';';
}
return static::code2utf($num, $lo);
}
}