免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1609 | 回复: 4
打印 上一主题 下一主题

soap客户端乱码,请指教 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-01-26 10:48 |只看该作者 |倒序浏览
使用soap的客户端访问时,如果将远程服务的数据和本地数据库读取的数据在同一个页面显示时,总有一方显示为乱码。请问如何解决?(注:远程服务器数据库和本地数据库各表的编码均为utf8_general_ci)。请各位大侠不吝指教,多谢!

论坛徽章:
0
2 [报告]
发表于 2006-01-26 20:06 |只看该作者
ok! all data from database both in local and remote encoded with same encoding.
Are you sure that your client page is same encoding as *.xml file which generated from
remote soup?
Checking encoding which in XML file generated by soup.
Set same encoding in your client page(ex.:HTTP HEADER rather than html meta-tag)
Encoding must be same in:
remote database => soup xml => client <= htmlpage <= local database
otherwise the result will be not correctly displaed and you should convert encoding

Best, ulmer

论坛徽章:
0
3 [报告]
发表于 2006-01-26 22:38 |只看该作者
谢谢ulmer大侠的关注先。

在下对soap的使用处在刚刚开始探索阶段,代码也是在网上搜索前辈们奉献的。

今天 PHP China 上有位高人让我把远端和本地读取的数据写入文本文件试下,试验的结果是文本文件里显示正常。

另外我得soap的客户端没有使用xml文件,只是在soap的服务器端返回一个简单的数组。soap客户端文件有你说得 header("content-type:text/html;charset=utf-8") 。当 header("content-type:text/html;charset=utf-8") 时,页面显示远端读取的数组的内容正常,本地读取的乱码;当header("content-type:text/html;charset=gb2312") 时,页面显示远端读取的数组的内容乱码,本地读取的正常。

不知问题到底出在那里?还请大侠您继续关注,非常感谢!!!!

论坛徽章:
0
4 [报告]
发表于 2006-01-26 23:25 |只看该作者
you should focuse on the local site, usually encoded data provided by remote webservice
(such as soup) that you can't change. !!! Unicode(UTF- is not equal to GBK!!!
Before the results to output you must convert the differenet encoded data in to the
same one. For expierence you can use comandline to excuse PHP script which only
fetch data from soup and local database, see what's happend in original raw data.
If different, that's meaning the encoding in both not same.You should treat them
with defferent encoding.
If same, the only problem is to set correct http header and HTML charset
P.S. if you use http request to get data, you should concern about URI-Encoding,
Escape, method GET/POST  etc...
Best, ulmer

论坛徽章:
0
5 [报告]
发表于 2006-01-27 09:32 |只看该作者
请问大侠,把soap和本地的数据写入文本文件 与 您说的命令行执行脚本,他们的结果有不同么?

还有,我的英文水平实在是....,麻烦您用汉语,可以么?

再次感谢!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP