Final Class yii\apidoc\helpers\EncodingHelper
| Inheritance | yii\apidoc\helpers\EncodingHelper |
|---|---|
| Source Code | https://github.com/yiisoft/yii2-apidoc/blob/master/helpers/EncodingHelper.php |
An auxiliary class for working with encodings.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| convertToUtf8WithHtmlEntities() | yii\apidoc\helpers\EncodingHelper |
Method Details
| 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',
);
}