note 127529 added to function.mb-convert-encoding
| From: | RainerPerske at main dot php dot net | Date: | Wed, 24 Aug 2022 13:35:29 +0000 |
| Subject: | note 127529 added to function.mb-convert-encoding | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219468@lists.php.net to get a copy of this message | ||
Text-encoding HTML-ENTITIES will be deprecated as of PHP 8.2.
To convert all non-ASCII characters into entities (to produce pure 7-bit HTML output), I was using:
<?php
echo mb_convert_encoding( htmlspecialchars( $text, ENT_QUOTES, 'UTF-8' ),
'HTML-ENTITIES', 'UTF-8' );
?>
I can get the identical result with:
<?php
echo mb_encode_numericentity( htmlentities( $text, ENT_QUOTES, 'UTF-8' ), [0x80, 0x10FFFF,
0, ~0], 'UTF-8' );
?>
The output contains well-known named entities for some often used characters and numeric entities
for the rest.
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.175 (proxied: 128.176.190.74)
----
Manual Page -- https://php.net/manual/en/function.mb-convert-encoding.php
Edit -- https://main.php.net/note/edit/127529
Del: integrated -- https://main.php.net/note/delete/127529/integrated
Del: useless -- https://main.php.net/note/delete/127529/useless
Del: bad code -- https://main.php.net/note/delete/127529/bad+code
Del: spam -- https://main.php.net/note/delete/127529/spam
Del: non-english -- https://main.php.net/note/delete/127529/non-english
Del: in docs -- https://main.php.net/note/delete/127529/in+docs
Del: other reasons-- https://main.php.net/note/delete/127529
Reject -- https://main.php.net/note/reject/127529
Search -- https://main.php.net/manage/user-notes.php