| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付买域名,送MP3、MP4
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY买空间,免费送域名(厦门中资源)
共有 294 人关注过本帖
标题:这个办法我用过不行
收藏  订阅  推荐  打印 
nieyudong
Rank: 1
等级:新手上路
帖子:6
积分:160
注册:2004-9-29
这个办法我用过不行

大家好我是北方数的一位员工,

我们公司要开发一个域名管理系统

但是在开发过程中遇到了一个问题,

就是要把POST 中的utf8转换成GB2312。

是这样的我用asp 中的XMLHTTP 向LINUX 服务器发出请求,发出请求时,要传递一些中文汉字,但是在提交时POST 中的中文汉字就成了UTF8 XMLTHHP就把UTF8传递给了LINUX服务器

但是LINUX 服务器收到UTF8时就会显示乱码,就不是正确的中文汉字,

因为对方LINUX 服务器只能接收GB2312国标码,

所以要做转换, 要把UTF8转换成GB2312才可以

可是我做过好几次转换都不行, LINUX服务器收到的还是UTF8码,也就是说还是乱码,

POST 中UTF8 还是没有转换成GB2312国标码

怎么办昵谁来帮帮我昵???????????

我的QQ是282157112

电话是0533-3160669

我姓 聂

名 玉栋

如果有会的请和我联系的

事成后重谢

关见是把POST 中的中文汉字转换成UTF8

还有对象的是LINUX 服务器啊

以下回复我用过不行

<% function UTF2GB(UTFStr) for Dig=1 to len(UTFStr) if mid(UTFStr,Dig,1)="%" then if len(UTFStr) >= Dig+8 then GBStr=GBStr & ConvChinese(mid(UTFStr,Dig,9)) Dig=Dig+8 else GBStr=GBStr & mid(UTFStr,Dig,1) end if else GBStr=GBStr & mid(UTFStr,Dig,1) end if next UTF2GB=GBStr end function

function ConvChinese(x) A=split(mid(x,2),"%") i=0 j=0

for i=0 to ubound(A) A(i)=c16to2(A(i)) next

for i=0 to ubound(A)-1 DigS=instr(A(i),"0") Unicode="" for j=1 to DigS-1 if j=1 then A(i)=right(A(i),len(A(i))-DigS) Unicode=Unicode & A(i) else i=i+1 A(i)=right(A(i),len(A(i))-2) Unicode=Unicode & A(i) end if next

if len(c2to16(Unicode))=4 then ConvChinese=ConvChinese & chrw(int("&H" & c2to16(Unicode))) else ConvChinese=ConvChinese & chr(int("&H" & c2to16(Unicode))) end if next end function

function c2to16(x) i=1 for i=1 to len(x) step 4 c2to16=c2to16 & hex(c2to10(mid(x,i,4))) next end function

function c2to10(x) c2to10=0 if x="0" then exit function i=0 for i= 0 to len(x) -1 if mid(x,len(x)-i,1)="1" then c2to10=c2to10+2^(i) next end function

function c16to2(x) i=0 for i=1 to len(trim(x)) tempstr= c10to2(cint(int("&h" & mid(x,i,1)))) do while len(tempstr)<4 tempstr="0" & tempstr loop c16to2=c16to2 & tempstr next end function

function c10to2(x) mysign=sgn(x) x=abs(x) DigS=1 do if x<2^DigS then exit do else DigS=DigS+1 end if loop tempnum=x

i=0 for i=DigS to 1 step-1 if tempnum>=2^(i-1) then tempnum=tempnum-2^(i-1) c10to2=c10to2 & "1" else c10to2=c10to2 & "0" end if next if mysign=-1 then c10to2="-" & c10to2 end function %>

搜索更多相关主题的帖子: 办法  
2004-9-29 13:59
寒星
Rank: 3Rank: 3
等级:中级会员
帖子:455
积分:4800
注册:2004-6-7

那再想想办法了,查查资料

http://www.68bar.com 版主位置空缺
2004-9-29 16:17
nieyudong
Rank: 1
等级:新手上路
帖子:6
积分:160
注册:2004-9-29

我查过

没有查到

你可以的我联系一下啊

2004-9-30 09:52
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.061294 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved