| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 690 人关注过本帖
标题:这个办法我用过不行
只看楼主 加入收藏
nieyudong
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2004-9-29
收藏
 问题点数:0 回复次数:2 
这个办法我用过不行

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

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

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

就是要把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-09-29 13:59
寒星
Rank: 1
等 级:新手上路
帖 子:455
专家分:0
注 册:2004-6-7
收藏
得分:0 
那再想想办法了,查查资料

http://www. 版主位置空缺
2004-09-29 16:17
nieyudong
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2004-9-29
收藏
得分:0 

我查过

没有查到

你可以的我联系一下啊

2004-09-30 09:52
快速回复:这个办法我用过不行
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022580 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved