Private ObjRgExDecode Set ObjRgExDecode=New RegExp With ObjRgExDecode .Global=true .IgnoreCase=true .Pattern ="(?:%[0-9a-f][0-9a-f])|." End With 006261の続き2005/04/13(水) 00:04:06ID:??? '●WinIEからのシフトJISデコード関数 sc;エンコード文字列 Public Function PF_Decode(ByVal sc) Dim ms,d0,d1,d,s
On Error Resume Next
Set ms=ObjRgExDecode.Execute (sc)
For each d in ms
if d0>"" then 'trueなら2バイト文字の2バイト目を調べる if left(d,1)="%" then 'エンコード文字 s=s & Chr(Clng(d0 & replace(d,"%",vbnullstring))) d0="" Else '2バイト目のはず s=s & Chr(CLng(d0 & "00") + AscB(d)) d0="" End if Else '1バイト目又は通常文字を調べる if Left(d,1)="%" then 'エンコード文字 d0=replace(d,"%","&H") d1=Clng(d0) if (&H81<=d1 and d1<=&H9f) or (&He0<=d1 and d1<=&Hfc) then '2バイト文字の1バイト目 else '1バイト文字エンコード d0="" s= s & Chr(d1) End if 006362の続き2005/04/13(水) 00:05:49ID:??? Else '通常文字とみなす if d="+" then s=s & " " else s=s & d end if End if End if