二维码解析后文字乱码,该怎么处理

WBOY
Release: 2016-06-13 12:09:04
Original
2403 people have browsed it

二维码解析后文字乱码

如图二维码
扫描后解析出来是乱码
urlencode后是如下内容
%C2%B0%C3%99%C2%B6%C3%88%C2%B0%C3%99%C2%BF%C3%86%C2%A3%C2%AD%C2%B6%C3%BE%C3%8E%C2%AC%C3%82%C3%AB%C2%B4%C3%8A%C3%8C%C3%B5
我用微信扫描解析却是可以的
内容是"百度百科-二维码词条"
这是经过了什么编码处理过么?怎么才能得到真正的结果?
------解决思路----------------------
这样判断能看明白吗

$s = '%C2%B0%C3%99%C2%B6%C3%88%C2%B0%C3%99%C2%BF%C3%86%C2%A3%C2%AD%C2%B6%C3%BE%C3%8E%C2%AC%C3%82%C3%AB%C2%B4%C3%8A%C3%8C%C3%B5';<br />$s = urldecode($s);<br /><br />if(mb_check_encoding('utf-8')) {<br />  $n = 0;<br />  for($i=0; $i<strlen($s); $i+=2) if((ord($s{$i}) & 0xf0) == 192) $n++;<br />  if($n > strlen($s)/2 * 0.8) $s = utf8_decode($s);<br />}<br />echo $s;
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template