求助,关于域名里的中文……
求助,如何把一串中文汉字在网址里变成类似:%E7%B2%BE%E7%BC%96%E8%8B%B1%E6%B1%89%E8%AF%8D%E5%85%B8的编码。。
%E7%B2%BE%E7%BC%96%E8%8B%B1%E6%B1%89%E8%AF%8D%E5%85%B8
用16进制数据转换试试
lcString = '中国' lcutf8 = Strconv(lcString,9) lcUrl = '' For i = 1 To Len(lcutf8) lcUrl = lcUrl + '%' + stol(Asc(Substr(lcutf8,i,1))) Next ? lcUrl Function stol &&将10进制转成16进制,仅对此程序有效 Lparameters num m.l = '' n1 = Int(num / 16) n2 = num % 16 Do Case Case n1 == 10 m.l = 'A' Case n1 == 11 m.l = 'B' Case n1 ==12 m.l = 'C' Case n1 = 13 m.l = 'D' Case n1 == 14 m.l = 'E' Case n1 == 15 m.l = 'F' Otherwise m.l = Transform(n1) Endcase Do Case Case n2 == 10 m.l = m.l + 'A' Case n2 == 11 m.l = m.l + 'B' Case n2 ==12 m.l = m.l + 'C' Case n2 = 13 m.l = m.l + 'D' Case n2 == 14 m.l = m.l + 'E' Case n2 == 15 m.l = m.l + 'F' Otherwise m.l = m.l + Transform(n2) Endcase Return m.l Endfunc参考一下