2009年12月15日 星期二

有關部份特殊字,顯示有時會出現亂碼的問題,
有找到參考的解決方法,如下

亂碼參考資料



<%

'===================================================================================='UTF-8跟BIG5互轉
'====================================================================================
Function Convert_ASCII_Unicode(str)

Dim old,new_w,j

old = str

new_w = ""

For j = 1 To Len(str)

if ascw(mid(old,j,1)) < 0 then

new_w = new_w & "&#" & ascw(mid(old,j,1)) + 65536 & ";"

ElseIf ascw(mid(old,j,1))>0 and ascw(mid(old,j,1))<127 then

new_w = new_w & mid(old,j,1)

Else

new_w = new_w & "&#" & ascw(mid(old,j,1)) & ";"

End if

Next

Convert_ASCII_Unicode = new_w

End Function



Function Convert_Unicode_ASCII(str)

Dim x,y,z,temp_word,flag

flag = 0

x = InStr(flag + 1,str,"&#")

Do Until x = 0 or x < flag

x = InStr(flag + 1,str,"&#")

if x <> 0 then

y = Mid(str,x,8)

Select Case InStr(y,";")

Case 8

z = chrw(Mid(y,3,5))

Case 7

z = chrw(Mid(y,3,4))

Case 6

z = chrw(Mid(y,3,3))

Case 5

z = chrw(Mid(y,3,2))

End Select

if InStr(y,";") > 4 And Asc(z) <> 63 then

str = Replace(str,Left(y,InStr(y,";")),z)

End if

flag = x

End if

Loop

Convert_Unicode_ASCII = str

End Function

%>

0 意見:

張貼留言