VB script, driving me crazy; vb bug ?
am 30.01.2008 18:15:23 von albertlaszloI have a very simple vb code, that suppose to remove some binary
character codes from a string. The results are different if the code
is running from IIS-WinXp or IIS-WinServer. After hours of searching I
managed to isolate the code that is creating the problem, but i cannot
understand why. Here is the code :
Z1.asp
<%
function Hexof(s)
dim ix, so
for ix =1 to len(s): so = so & Hex(Asc(Mid(s,ix,1))) & ".": next
HexOf = so
end function
Function Test()
Dim ix, s1
s1=""
For ix = 127 To 191: s1 = s1 & chr(ix): next
response.write "127..191....." & Hexof(s1)
End Function
test
%>
The results I get in IE 6, are :
for IIS on Win XP (INCORRECT?)
127..191.....7F.0.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F. 7F.7F.7F.
7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F. 7F.7F.7F.
7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F.7F. 7F.7F.7F.
for IIS on Win 2000 server (as expected):
127..191.....7F.80.81.82.83.84.85.86.87.88.89.8A.8B.8C.8D.8E .8F.
90.91.92.93.94.95.96.97.98.99.9A.9B.9C.9D.9E.
9F.A0.A1.A2.A3.A4.A5.A6.A7.A8.A9.AA.AB.AC.AD.AE.AF.B0.B1.B2. B3.B4.B5.B6.B7.B8.B9.BA.BB.BC.BD.BE.BF.
the funny part is that if run the same script from different locations
in the same IE session, I get inconsistent result
1. running XP\z1.asp returns the INcorrect result
2. running server\z1.asp returns the correct result
3. running XP\z1.asp returns the CORRECT result Surprised ?
I really am
Somebody might help me to get this thing out of my mind
Thanks
Laszlo