OK, here's my problem. I have an HTML file that has Japanese characters in
it. I want to be able to get those characters and put them in my SQL
database so that they can be retrieved on another asp page.
So, I grabbed the characters (cut/paste) and inserted them in the database
using QueryAnalyzer (setting the font to a Japanese font, of course). Then
I can get them out. Yippee, it worked (after first setting the
session.codepage=932 AND setting a header <META HTTP-EQUIV="Content-Type"
CONTENT="text/html; CHARSET=shift_jis">)!
OK, now I want to do this on a regular basis using code. Set everything up,
copy the characters into the database and WHOOPS! Does not work.
Here's some code (asp page!):
<% option explicit %>
<HTML>
<HEAD>
<%
Session.Codepage=932
%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=shift_jis">
</HEAD>
<BODY>
<%
Dim objFS
Dim objTS
Dim objComm
set objFS = Server.CreateObject("Scripting.FileSystemObject")
set objComm = Server.CreateObject("ADODB.Command")
objComm.ActiveConnection = <MyConnectionString>
response.write "headline<BR>"
Set objTS = objFS.OpenTextFile(Server.MapPath("/Title.txt"))
InsertItem objTS, "headline", objComm
objTS.Close
response.write "brief<BR>"
Set objTS = objFS.OpenTextFile(Server.MapPath("/Headline.txt"))
InsertItem objTS, "brief", objComm
objTS.Close
response.write "body<BR>"
Set objTS = objFS.OpenTextFile(Server.MapPath("/body.txt"))
InsertItem objTS, "body", objComm
objTS.Close
set objComm = nothing
set objFS = nothing
Private Sub InsertItem(objTS , strField, objComm)
Dim strIn, strInsertString
Dim strSQL
response.write "Field: " & strField & "==================" & vbCrLf &
vbCrLf
strInsertString = ""
Do While Not objTS.AtEndOfStream
strIn = cstr(objTS.ReadLine)
strInsertString = strInsertString & strIn
response.write strIn
Loop
strSQL = "UPDATE v2_article " & _
" SET " & strField & " = N'" & strInsertString & "' " & _
" WHERE item_id=51116"
objComm.CommandText = strSQL
objComm.Execute
End Sub
%>
</BODY>
</HTML>
I get a bunch of JUNK characters in the database. Not Japanese, Not
question marks. What am I doing wrong?
TIA,
Owen (Tearing my hair out)