Jump to content

Classic ASP & xmlHttp: Incorrect string value: '\xC2\x93m\xC3\xA1s...'


safetyweek

Recommended Posts

Hi everyone.What does this error? The Google search returns nothing...

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [MySQL][ODBC 5.1 Driver][mysqld-5.1.44-community]Incorrect string value: '\xC2\x93m\xC3\xA1s...' for column 'q' at row 1 /casting/index.asp, line 161

Can you help me?

<%Set objConn = Server.CreateObject("ADODB.Connection")objConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" &_					  "SERVER=localhost;PORT=3306;DATABASE=db;" &_					  "USER=root;PASSWORD=123456;OPTION=3;"Response.Expires = -1Randomize()intUP  = 199intLow = 1URLToRSS = "http://www.elpais.com/rss/feed.html?feedId=17042"MaxNumberOfItems = 20Keyword1 = ""Keyword2 = ""Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")xmlHttp.Open "GET", URLToRSS, falsexmlHttp.Send()RSSXML = xmlHttp.ResponseTextSet xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")xmlDOM.async = FalsexmlDOM.validateOnParse = FalsexmlDom.resolveExternals = FalseIf not xmlDOM.LoadXml(RSSXML) ThenErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessageEnd IfSet xmlHttp = NothingSet RSSItems = xmlDOM.getElementsByTagName("item")RSSItemsCount = RSSItems.Length-1if RSSItemsCount = -1 ThenSet RSSItems = xmlDOM.getElementsByTagName("entry")RSSItemsCount = RSSItems.Length-1End IfSet xmlDOM = Nothingj = -1For i = 0 To RSSItemsCountSet RSSItem = RSSItems.Item(i)RSSdescription=" " RSSCommentsLink=" "for each child in RSSItem.childNodesSelect case lcase(child.nodeName)case "title"RSStitle = child.textcase "link"If child.Attributes.length>0 ThenRSSLink = child.GetAttribute("href")if (RSSLink <> "") Thenif child.GetAttribute("rel") <> "alternate" ThenRSSLink = ""End IfEnd IfEnd IfIf RSSLink = "" ThenRSSlink = child.textEnd Ifcase "description"RSSdescription = child.textcase "content" ' atom formatRSSdescription = child.textcase "published"' atom formatRSSDate = child.textcase "pubdate"RSSDate = child.textcase "comments"RSSCommentsLink = child.textcase "category"Set CategoryItems = RSSItem.getElementsByTagName("category")RSSCategory = ""for each categoryitem in CategoryItemsif RSSCategory <> "" ThenRSSCategory = RSSCategory & ", "End IfRSSCategory = RSSCategory & categoryitem.textNextEnd SelectnextIf (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSDescription,Keyword2)>0) thenj = J+1if J<MaxNumberOfItems thenItemContent = Replace(ItemTemplate,"{LINK}",RSSlink)ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle)ItemContent = Replace(ItemContent,"{DATE}",RSSDate)ItemContent = Replace(ItemContent,"{COMMENTSLINK}",RSSCommentsLink)ItemContent = Replace(ItemContent,"{CATEGORY}",RSSCategory)Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription)response.write "DESC = " & RSSDescription & "<br>" &_			   "LINK = " & RSSlink & "<br>" &_			   "TITO = " & RSSTITLE & "<br>" &_			   "DATA = " & RSSDATE & "<br>" &_			   "COMM = " & RSSCOMMENTSLINK & "<br>" &_			   "CATE = " & RSSCATEGORY & "<br><br>"			   			   query_select = "SELECT * FROM "query_select = query_select & " TBL_Q "query_select = query_select & " WHERE "query_select = query_select & " author  = 'elpais.com' "query_select = query_select & " AND "query_select = query_select & " title = '" & (RSSTitle) & "' "response.write query_select & "<br><br>"response.flush()set estilosRS = Server.CreateObject("ADODB.Recordset")estilosRs.Open query_select, objConnif not estilosRs.eof And not estilosRs.bof then  elseintRange = intUp - intLow intRandom = CInt ((intRange * Rnd()) + intLow)intRange2 = intUp + intLow intRandom2 = CInt ((intRange * Rnd()) - intLow)strSQL = "INSERT INTO TBL_Q"strSQL = strSQL & " ("strSQL = strSQL & "  q, "strSQL = strSQL & "  author, "strSQL = strSQL & "  title, "strSQL = strSQL & "  rating, "strSQL = strSQL & "  tot_rating, "strSQL = strSQL & "  URL, "strSQL = strSQL & "  datareg "strSQL = strSQL & " )"strSQL = strSQL & "  VALUES"strSQL = strSQL & " ("strSQL = strSQL & " '" & Replace(RSSDescription, "\", "\\") & "', "   strSQL = strSQL & " 'elpais.com', "strSQL = strSQL & " '" & (RSSTitle) & "', "strSQL = strSQL & "  " & (intRandom) & ", "strSQL = strSQL & "  " & (intRandom2) & ", "strSQL = strSQL & " '" & (RSSlink) & "', "strSQL = strSQL & " '" & Date() & "' "strSQL = strSQL & " )"response.write strsql & "<br><br>"response.flush()objconn.execute strSQLend if  estilosRS.Close  set estilosRS = nothingItemContent = ""RSSLink = ""End ifEnd IfNextif RSSItemsCount > 0 thenResponse.Write MainTemplateFooterelseResponse.Write ErrorMessageEnd IfobjConn.Close()Set objConn = Nothing%>

line 161 = objconn.execute strSQL

Link to comment
Share on other sites

Thanks Sir.Code ASP changed, but I have same error and in MySQL I don't have set encoding UTF-8... :)

<%Set objConn = Server.CreateObject("ADODB.Connection")objConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" &_					  "SERVER=localhost;PORT=3306;DATABASE=db;" &_					  "USER=root;PASSWORD=123456;OPTION=3;"Response.Expires = -1Response.ContentType = "text/html"  Response.AddHeader "Content-Type", "text/html;charset=UTF-8"  Response.CodePage = 65001   Response.CharSet = "UTF-8"  Randomize()intUP  = 199intLow = 1URLToRSS = "http://www.elpais.com/rss/feed.html?feedId=17042"MaxNumberOfItems = 20Keyword1 = ""Keyword2 = ""Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")xmlHttp.Open "GET", URLToRSS, falsexmlHttp.Send()RSSXML = xmlHttp.ResponseTextSet xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")xmlDOM.async = FalsexmlDOM.validateOnParse = FalsexmlDom.resolveExternals = FalseIf not xmlDOM.LoadXml(RSSXML) ThenErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessageEnd IfSet xmlHttp = NothingSet RSSItems = xmlDOM.getElementsByTagName("item")RSSItemsCount = RSSItems.Length-1if RSSItemsCount = -1 ThenSet RSSItems = xmlDOM.getElementsByTagName("entry")RSSItemsCount = RSSItems.Length-1End IfSet xmlDOM = Nothingj = -1For i = 0 To RSSItemsCountSet RSSItem = RSSItems.Item(i)RSSdescription=" " RSSCommentsLink=" "for each child in RSSItem.childNodesSelect case lcase(child.nodeName)case "title"RSStitle = child.textcase "link"If child.Attributes.length>0 ThenRSSLink = child.GetAttribute("href")if (RSSLink <> "") Thenif child.GetAttribute("rel") <> "alternate" ThenRSSLink = ""End IfEnd IfEnd IfIf RSSLink = "" ThenRSSlink = child.textEnd Ifcase "description"RSSdescription = child.textcase "content" ' atom formatRSSdescription = child.textcase "published"' atom formatRSSDate = child.textcase "pubdate"RSSDate = child.textcase "comments"RSSCommentsLink = child.textcase "category"Set CategoryItems = RSSItem.getElementsByTagName("category")RSSCategory = ""for each categoryitem in CategoryItemsif RSSCategory <> "" ThenRSSCategory = RSSCategory & ", "End IfRSSCategory = RSSCategory & categoryitem.textNextEnd SelectnextIf (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSDescription,Keyword2)>0) thenj = J+1if J<MaxNumberOfItems thenItemContent = Replace(ItemTemplate,"{LINK}",RSSlink)ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle)ItemContent = Replace(ItemContent,"{DATE}",RSSDate)ItemContent = Replace(ItemContent,"{COMMENTSLINK}",RSSCommentsLink)ItemContent = Replace(ItemContent,"{CATEGORY}",RSSCategory)Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription)response.write "DESC = " & RSSDescription & "<br>" &_			   "LINK = " & RSSlink & "<br>" &_			   "TITO = " & RSSTITLE & "<br>" &_			   "DATA = " & RSSDATE & "<br>" &_			   "COMM = " & RSSCOMMENTSLINK & "<br>" &_			   "CATE = " & RSSCATEGORY & "<br><br>"			   			   query_select = "SELECT * FROM "query_select = query_select & " TBL_Q "query_select = query_select & " WHERE "query_select = query_select & " author  = 'elpais.com' "query_select = query_select & " AND "query_select = query_select & " title = '" & (RSSTitle) & "' "response.write query_select & "<br><br>"response.flush()set estilosRS = Server.CreateObject("ADODB.Recordset")estilosRs.Open query_select, objConnif not estilosRs.eof And not estilosRs.bof then  elseintRange = intUp - intLow intRandom = CInt ((intRange * Rnd()) + intLow)intRange2 = intUp + intLow intRandom2 = CInt ((intRange * Rnd()) - intLow)strSQL = "INSERT INTO TBL_Q"strSQL = strSQL & " ("strSQL = strSQL & "  q, "strSQL = strSQL & "  author, "strSQL = strSQL & "  title, "strSQL = strSQL & "  rating, "strSQL = strSQL & "  tot_rating, "strSQL = strSQL & "  URL, "strSQL = strSQL & "  datareg "strSQL = strSQL & " )"strSQL = strSQL & "  VALUES"strSQL = strSQL & " ("strSQL = strSQL & " '" & Replace(RSSDescription, "\", "\\") & "', "   strSQL = strSQL & " 'elpais.com', "strSQL = strSQL & " '" & (RSSTitle) & "', "strSQL = strSQL & "  " & (intRandom) & ", "strSQL = strSQL & "  " & (intRandom2) & ", "strSQL = strSQL & " '" & (RSSlink) & "', "strSQL = strSQL & " '" & Date() & "' "strSQL = strSQL & " )"response.write strsql & "<br><br>"response.flush()objconn.execute strSQLend if  estilosRS.Close  set estilosRS = nothingItemContent = ""RSSLink = ""End ifEnd IfNextif RSSItemsCount > 0 thenResponse.Write MainTemplateFooterelseResponse.Write ErrorMessageEnd IfobjConn.Close()Set objConn = Nothing%>

line 161 = objconn.execute strSQL

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...