blistovmhz

Untitled

Oct 3rd, 2018
180
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //decode decimal HTML entities added by web browser
  3. $body = preg_replace('/&#\d{2,5};/ue', "utf8_entity_decode('$0')", $body );
  4. //decode hex HTML entities added by web browser
  5. $body = preg_replace('/&#x([a-fA-F0-7]{2,8});/ue', "utf8_entity_decode('&#'.hexdec('$1').';')", $body );
  6.  
  7. //callback function for the regex
  8. function utf8_entity_decode($entity){
  9. $convmap = array(0x0, 0x10000, 0, 0xfffff);
  10. return mb_decode_numericentity($entity, $convmap, 'UTF-8');
  11. }
  12. ?>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×