您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

asp.net中中文乱码问题

2024/4/9 3:09:27发布15次查看
asp.net默认的编码为utf-8,当与其它平台交互处理的字符串中有中文时往往会出现乱码,这是由于其它平台多采取gb2312编码,要解决这一问题,可编写一个函数,对字符串先转换再处理就行了,下面是该函数的源代码:
imports system.math function urlencoding(byval vstrin as string) dim strreturn as string strreturn = "" dim i as integer dim thischr as string dim innercode, hight8, low8 as integer for i = 1 to vstrin.length thischr = mid(vstrin, i, 1) if abs(asc(thischr)) < &hff then strreturn = strreturn & thischr else innercode = asc(thischr) if innercode < 0 then innercode = innercode + &h10000 end if hight8 = (innercode and &hff00) / &hff low8 = innercode and &hff strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8) end if next urlencoding = strreturn end function
以上就是asp.net中中文乱码问题的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product