Skip to content

Instantly share code, notes, and snippets.

@firejune
Forked from GeHou/is_utf8.php
Created July 4, 2016 08:21
Show Gist options
  • Save firejune/30a906a349b16cec5408e99b9666b5b7 to your computer and use it in GitHub Desktop.
Save firejune/30a906a349b16cec5408e99b9666b5b7 to your computer and use it in GitHub Desktop.
php:is_utf8
<?php
function is_utf8($str) {
$temp_str = @iconv('utf-8', 'utf-8', $str);
if ($str === $temp_str) {
return 'utf8';
} else {
return 'gbk';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment