$convmap = [0, 0x1FFFFF, 0, 0x10FFFF]; $str = mb_encode_numericentity('StringToBeEncoded', $convmap); echo $str; Tags php