Advertisement
rAthus

[PHP] convert any string of any type to UTF-8

Nov 29th, 2018
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.14 KB | None | 0 0
  1. // convert any string of any type to UTF-8
  2. function decode2utf8($str) {
  3.     return (mb_detect_encoding($str)=='UTF-8')?$str:utf8_encode($str);
  4. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement