我有將HTML編碼文本轉換回HTML的功能。它的偉大工程正常,但由於某些原因,我嘗試使用它今天一些文字,並出現以下錯誤:經典ASP:當我不應該出現類型不匹配錯誤
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'UnChkString'
/manage/solutions_delete.asp, line 22
我使用這個功能的線路是:
<%= UnChkString(solution_desc) %>
該solution_desc
變量是:
<p>Here is a description of what this solution is all about.</p>
領域的數據庫中被甩開了solution_desc
是一個文本字段。
我UnChkString功能是:
Function UnChkString(string)
UnChkString = Replace(string,"[%]","%")
UnChkString = HTMLDecode(UnChkString)
End Function
的HTMLDecode功能是:
Function HTMLDecode(sText)
Dim I
sText = Replace(sText, "&" , Chr(38))
sText = Replace(sText, "&" , "&")
sText = Replace(sText, """, Chr(34))
sText = Replace(sText, "’", Chr(39))
sText = Replace(sText, "<" , Chr(60))
sText = Replace(sText, ">" , Chr(62))
sText = Replace(sText, " ", Chr(32))
For I = 1 to 255
sText = Replace(sText, "&#" & I & ";", Chr(I))
Next
HTMLDecode = sText
End Function
編輯
我甚至已經試過:
<%= UnChkString(CStr(solution_desc)) %>
沒有運氣。
哪一行是第22行? – bfavaretto 2012-03-08 14:40:25
@bfavaretto'<%= UnChkString(solution_desc)%>' – James 2012-03-08 14:41:15
也許你從數據庫中獲得'NULL'?錯誤是否發生在您發佈的示例字符串中? – bfavaretto 2012-03-08 14:46:15