We all know that ACCESS is a close partner of ASP. Because two of the simplest things always create sparks when they come together.
However, when our filtering is not strict, Japanese characters often appear. At this time, Japanese overflow will occur after searching.
At this time, the idea we can usually think of is to find an exe program to solve this problem. I originally wrote such a similar program in C#.
You should be able to find the one I wrote before on Google. I won’t say any more.
Then one day, I found that ASP could do it. I really felt like shit at the time.
However, this method of ASP is very bad. It is easy to cause system crash (if the database is large).
So just writing here. It can be regarded as a starting point.
'Let me explain it below:
Function TransferJapanDc9CnInDB()
On Error Resume Next
Err.Clear
Dim objRS,i
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.CursorType = adOpenKeyset
objRS.LockType = adLockReadOnly
objRS.ActiveConnection=objConn
objRS.Source="SELECT * FROM [blog_Comment]"
objRS.Open()
If (Not objRS.bof) And (Not objRS.eof) Then
For i=1 to objRS.RecordCount
'Traverse and see if there is any Japanese text. If so, it will overflow. Just search for anything. It doesn’t matter what you search for. Because it is traversing ACCESS, as long as the pointer moves to Japanese, it will overflow.
objConn.Execute("SELECT * FROM [blog_Comment] WHERE comm_ID="&objRS("comm_ID")&" AND [comm_Content] LIKE '%URL%'")
If Err.Number=-2147217900 Then
'Because on err continues, the overflow error code is found here. This was debugged by myself, and it was not actually found from somewhere.
objConn.Execute("UPDATE [blog_Comment] SET [comm_Content]='"&FilterSQL(Japan2Html(objRS("comm_Content")))&"',[comm_Author]='"&FilterSQL(Japan2Dc9CnHtml(objRS("comm_Author"))) &"' WHERE comm_ID="&objRS("comm_ID")&" ")
'This is to replace the Japanese text. Isn't the idea very clever? kindness. However, if the database becomes huge, repeated overflow will cause problems. Memory babies will cry.
Err.Clear
End If
objRS.MoveNext
Next
End If
objRS.Close
Set objRS=Nothing
'www.dc9.cn http://www.devdao.com/ 07/11/28
End Function
Function Japan2Dc9CnHtml(source)
source=Replace(source,"ガ","ガ")
source=Replace(source,"ギ","ギ")
source=Replace(source,"ア","ア")
source=Replace(source,"ゲ","ゲ")
source=Replace(source,"ゴ","ゴ")
source=Replace(source,"ザ","ザ")
source=Replace(source,"ジ","ジ")
source=Replace(source,"ズ","ズ")
source=Replace(source,"ゼ","ゼ")
source=Replace(source,"ゾ","ゾ")
source=Replace(source,"ダ","ダ")
source=Replace(source,"ヂ","ヂ")
source=Replace(source,"ヅ","ヅ")
source=Replace(source,"デ","デ")
source=Replace(source,"ド","ド")
source=Replace(source,"バ","バ")
source=Replace(source,"パ","パ")
source=Replace(source,"ビ","ビ")
source=Replace(source,"ピ","ピ")
source=Replace(source,"ブ","ブ")
source=Replace(source,"ブ","ブ")
source=Replace(source,"プ","プ")
source=Replace(source,"ベ","ベ")
source=Replace(source,"ペ","ペ")
source=Replace(source,"ボ","ボ")
source=Replace(source,"ポ","ポ")
source=Replace(source,"ヴ","ヴ")
Japan2Html=source
End Function