php判断字符串编码是否为utf8的函数
来源:互联网 发布:pc 文件夹恢复软件 编辑:程序博客网 时间:2024/06/05 06:21
function is_utf8($word)
{
if(preg_match("/^([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){1}/",$word) == true || preg_match("/([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){1}$/",$word) == true || preg_match("/([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){2,}/",$word) == true) {
return true;
}else {
return false;
}
}
$t = 'wangbin';
//$t = iconv('GB2312','UTF-8',$t)
var_dump(is_utf8($t));
{
if(preg_match("/^([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){1}/",$word) == true || preg_match("/([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){1}$/",$word) == true || preg_match("/([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){2,}/",$word) == true) {
return true;
}else {
return false;
}
}
$t = 'wangbin';
//$t = iconv('GB2312','UTF-8',$t)
var_dump(is_utf8($t));
- php判断字符串编码是否为utf8的函数
- PHP判断字符串编码是否utf8并转换的方法
- PHP判断字符串编码是否utf8并转换的方法
- PHP判断字符串编码是否utf8并转换的方法
- php 检查字符串是否为UTF8编码
- PHP检测字符串是否为UTF8编码的常用方法
- php判断是否为GBK编码并转换为utf8
- 判断字符串是否UTF8编码
- php检测字符串编码(utf-8,gbk,gb2312)是否为utf8编码的方法总结
- php判断字符串的编码以及将字符串从GBK转换为UTF8字符集
- 判断char*是否为utf8编码
- C++实例:判断字符串是否UTF8编码
- PHP 判断文字是否为utf8
- 字符串编码是否UTF8
- 判断是否utf8编码的算法
- PHP判断编码是否为utf-8 函数
- 判断字符串的编码类型(GBK / UTF8)
- 判断字符串的编码类型(GBK / UTF8)
- class, struct, union
- 指针的魅力
- json,xml转换成hash (brown_zhang)
- Android ProgressBar 各种样式大全
- 关于程序员的笑话(十三)
- php判断字符串编码是否为utf8的函数
- .Net反射工厂设计模式
- C++ Primer Plus学习:第七章 函数-C++的编程模块(4)
- vc注释宏,IDE工具宏添加方法(转)
- AWStats性能优化调整
- Remove Master Utilities Scareware
- 关于Android sdk隐藏接口的使用
- android工程引入第三方jar包,如果发现混淆后无法签名成功,该怎么办
- 关于程序员的笑话(十四)