How to convert UTF8 characters to numeric character entities in PHP How to convert UTF8 characters to numeric character entities in PHP php php

How to convert UTF8 characters to numeric character entities in PHP


Use mb_encode_numericentity:

$convmap = array(0x80, 0xffff, 0, 0xffff);echo mb_encode_numericentity($utf8Str, $convmap, 'UTF-8');