• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

PHP: convert all UTF-8 characters to HTML entities

phputf-8


PHP Snippet 1:

echo encodespecial('? ? Hello World ? ? ? this is a test....');
function encodespecial($str) {
    $convmap = array(0x80, 0xfffffff, 0, 0xfffffff);
    return mb_encode_numericentity($str, $convmap, 'UTF-8');
}

Related Snippets

Converting alphabet letter to alphabet position in PHP [duplicate]

Reorder attribute dropdown terms in Woocommerce single variable products

backup files to google drive using PHP

Transfer data between JavaScript and PHP through JSON

How to get page number on dompdf PDF when using "view"

cakephp save drag and drop list order to database

How do I do HTTP basic authentication using Guzzle?

oauth-private.key does not exist or is not readable

IlluminateDatabaseQueryException could not find driver [duplicate]

Laravel post contact form giving me error 419

ConstraintViolationListInterface to Exception in Symfony

Return new collection without modifying original collection

With doctrine ODM, can I embed many subdocuments in a main document?

Cannot pass null argument when using type hinting

add_action() function in wordpress not working [duplicate]

About Contact Privacy policy Terms and conditions