Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. приобр&
  2.  
  3. оставка
  4.  
  5. function Unicode2Charset($string, $charset = 'UTF-8') {
  6. $string = html_entity_decode($string, ENT_NOQUOTES, $charset);
  7. return preg_replace(
  8. '~&#(?:x([da-f]+)|(d+));~ie',
  9. 'iconv("UTF-16LE", $charset, pack("v", "$1" ? hexdec("$1") : "$2"))',
  10. $string
  11. );
  12. }
  13. $string = 'приобр&';
  14.  
  15. echo Unicode2Charset($string); // OutPut приобр&
  16.  
  17. <?php
  18. echo html_entity_decode(
  19. "&#1087;&#1088;&#1080;&#1086;&#1073;&#1088;",
  20. ENT_COMPAT,
  21. "UTF-8"
  22. );
  23. ?>
  24.  
  25. приобр
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement