[英]How to determine a string that needs to be UTF8 decoded
如果需要在PHP中解码UTF8,是否有可能检查字符串?
您可以使用mb_detect_encoding
检查字符串是否已经以UTF-8编码:
mb_detect_encoding($str, 'UTF-8', true)
如果字符串无效UTF-8,则返回false 。
您可以使用确定字符串是否使用UTF-8编码
mb_detect_encoding($str, 'UTF-8');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.