Final Class yii\apidoc\helpers\EncodingHelper

Inheritanceyii\apidoc\helpers\EncodingHelper
Source Code https://github.com/yiisoft/yii2-apidoc/blob/master/helpers/EncodingHelper.php

An auxiliary class for working with encodings.

Method Details

Hide inherited methods

convertToUtf8WithHtmlEntities() public static method

public static string convertToUtf8WithHtmlEntities ( string $string )
$string string

                public static function convertToUtf8WithHtmlEntities(string $string): string
{
    // The solution is taken from here: https://github.com/symfony/symfony/issues/44281#issuecomment-1647665965
    return mb_encode_numericentity(
        htmlspecialchars_decode(
            htmlentities($string, ENT_NOQUOTES, 'UTF-8', false),
            ENT_NOQUOTES,
        ),
        [0x80, 0x10FFFF, 0, ~0],
        'UTF-8',
    );
}