最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Python和php之间通信中文乱码解决办法
时间:2014-03-26 编辑:简简单单 来源:一聚教程网
即使在urlencode之前str.decode(“cp936″).encode(“utf-8″)做了编码转换也是没用的。后来查询手册查到一个urllib.quote()函数,用此方法成功解决!
python端:
代码如下 | 复制代码 |
str = "中文" str = urllib.quote(str.decode("cp936").encode("utf-8")) postData = {} postData['str'] = str |
...post请求发送代码...
php端:
代码如下 | 复制代码 |
$str = urldecode($_POST['str']) echo $str; |
完美解决乱码问题!
相关文章
- 解决PHP中文乱码的4项小技巧 12-15
- php中文乱码问题解决方法 07-04
- php中文乱码问题总结与解决办法 05-30
- php 中文乱码的解决方法大集 06-23
- php 调用 webservice 中文乱码解决方案 06-21
- php中文文名下载乱码解决方法 05-09