php http通讯

WBOY
WBOYOriginal
2016-06-23 14:10:531394browse

1.$strr2=$_COOKIE['log']; //应用程序(mfc写的)发送的字符串为log

传送的有外国的,比如韩文的,还有日文,还有少数民族的语言,还有中文,英文。 应用程序将两个字节变成一个字节发给web端,那php接受为第一行的代码,然后我应该怎么用代码进行转换,才能在网页上正常显示各个语言。我知道,网页是utf-8都可以显示。就是怎么样从应用程序的一个字节转成utf-8格式。


回复讨论(解决方案)

应用程序将两个字节变成一个字节发给web端???
那不就丢失了信息?怎么能还原呢?

function convToUtf8($str) {     if( mb_detect_encoding($str,"UTF-8, ISO-8859-1, GBK")!="UTF-8" )     {         return iconv("gbk","utf-8",$str);     }else {         return $str;     } } 

Statement:
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