Home  >  Article  >  Backend Development  >  UTF-8编码的程序POST数据给一个GBK编码的程序接收,应该怎么处理?

UTF-8编码的程序POST数据给一个GBK编码的程序接收,应该怎么处理?

WBOY
WBOYOriginal
2016-06-23 14:17:45857browse

我的系统是UTF-8编码开发的,现在由于某个业务和另外一家业务之间有数据要传输,现在要从我这边POST数据给对方,对方那边的编码是GBK的,请问我在POST数据时应该怎么处理才不会有问题呢?


回复讨论(解决方案)

把数据转成 gbk 的再
要嘛就要求对方适应你

要么把你的POST页面改成gb2312格式。要么让对方在接收你的utf-8数据时做下转码。转码函数如下:
iconv("UTF-8","GB2312",$_POST[aaa])
//将变量$_POST[aaa]的编码格式转换成utf-8的形式。

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