1

我正在向我的asp页面发送一个发布请求,我使用我得到的参数以这种方式读取文件:

station = request.form("station")
StationFolderPath = currentDir & "iPhoneListener\Locations\" & station
fs.FolderExists(StationFolderPath)

用英文字母没有问题。但是当我发送希伯来字母时,它找不到文件夹。我用这个检查过

response.write(right(station,6))

并得到:#1497也许有人知道如何将其编码&#1497为普通字母。

谢谢

4

1 回答 1

0

您可以从此处使用 HTML 解码功能并将代码中的第一行更改为 station = HTMLDecode(request.form("station"))。

Function HTMLDecode(sText)
    Dim regEx
    Dim matches
    Dim match
    sText = Replace(sText, """, Chr(34))
    sText = Replace(sText, "<"  , Chr(60))
    sText = Replace(sText, ">"  , Chr(62))
    sText = Replace(sText, "&" , Chr(38))
    sText = Replace(sText, " ", Chr(32))


    Set regEx= New RegExp

    With regEx
     .Pattern = "&#(\d+);" 'Match html unicode escapes
     .Global = True
    End With

    Set matches = regEx.Execute(sText)

    'Iterate over matches
    For Each match in matches
        'For each unicode match, replace the whole match, with the ChrW of the digits.

        sText = Replace(sText, match.Value, ChrW(match.SubMatches(0)))
    Next

    HTMLDecode = sText
End Function
于 2012-11-19T06:08:31.997 回答