![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Convert Windows-1255 RSS to unicode, so I can call loadXML Hi, I have a short vbscript on an ASP page, and I want to perform loadXML to this rss: http://www.notes.co.il/rss.asp?b=7 Since it's encoded in Windows-1255, the loadXML fails. I've tried using the conversion function here: http://www.planet-source-code.com/vb...=7266&lngWId=4 Like this: dim oXMLHTTP set oXMLHTTP=Server.CreateObject("MSXML2.ServerXMLHTTP.4.0") oXMLHTTP.open "GET", url , false oXMLHTTP.send null dim xmlDoc Set xmlDoc=Server.CreateObject("MSXML2.DOMDocument.4.0") xmlDoc.loadXML StrConv (oXMLHTTP.ResponseText,vbUnicode) But it doesn't work. Basically, the StrConv returns nothing. Any ideas how I can get that RSS into the xmlDoc? Thanks, Gabi |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Convert Windows-1255 RSS to unicode, so I can call loadXML On May 13, 2:34*am, Gabriela <frohlin...@xxxxxx> wrote: Quote: > Hi, > I have a short vbscript on an ASP page, and I want to perform loadXML > to this rss:http://www.notes.co.il/rss.asp?b=7 > Since it's encoded in Windows-1255, the loadXML fails. > > I've tried using the conversion function here:http://www.planet-source-code.com/vb...sp?txtCodeId=7... > Like this: > > * * * * dim oXMLHTTP > * * * * set oXMLHTTP=Server.CreateObject("MSXML2.ServerXMLHTTP.4.0") > * * * * oXMLHTTP.open "GET", url , false > * * * * oXMLHTTP.send null > > * * * * dim xmlDoc > * * * * Set xmlDoc=Server.CreateObject("MSXML2.DOMDocument.4.0") > * * * * xmlDoc.loadXML StrConv (oXMLHTTP.ResponseText,vbUnicode) > > But it doesn't work. > Basically, the StrConv returns nothing. > > Any ideas how I can get that RSS into the xmlDoc? > > Thanks, > Gabi StrConv(...): http://www.planet-source-code.com/UR...!4/anyname.htm ANSIToUnicode(...): http://www.planet-source-code.com/vb...=7266&lngWId=4 Both return nothing. Thanks again, Gabi |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Convert Windows-1255 RSS to unicode, so I can call loadXML Gabriela schrieb: Quote: > Hi, > I have a short vbscript on an ASP page, and I want to perform loadXML > to this rss: > http://www.notes.co.il/rss.asp?b=7 > Since it's encoded in Windows-1255, the loadXML fails. > > I've tried using the conversion function here: > http://www.planet-source-code.com/vb...=7266&lngWId=4 > Like this: > > dim oXMLHTTP > set oXMLHTTP=Server.CreateObject("MSXML2.ServerXMLHTTP.4.0") > oXMLHTTP.open "GET", url , false > oXMLHTTP.send null > > dim xmlDoc > Set xmlDoc=Server.CreateObject("MSXML2.DOMDocument.4.0") > xmlDoc.loadXML StrConv (oXMLHTTP.ResponseText,vbUnicode) > > But it doesn't work. > Basically, the StrConv returns nothing. > > Any ideas how I can get that RSS into the xmlDoc? > > Thanks, > Gabi difficulties with that encoding. I used this test code: ''# getRssXml - get some rss as xml ' http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx ' ############################################################################ Option Explicit Dim sURL : sURL = "http://www.notes.co.il/rss.asp?b=7" Dim aGetters : aGetters = Array( "WinHttp.WinHttpRequest.5.1", "MSXML2.XMLHTTP" ) Dim sGetter For Each sGetter In aGetters WScript.Echo "Getter", sGetter Dim oGetter : Set oGetter = CreateObject( sGetter ) Dim nErr, sErr oGetter.open "GET", sURL, False On Error Resume Next oGetter.Send nErr = Err.Number sErr = Err.Description On Error GoTo 0 If 0 = nErr Then WScript.Echo oGetter.Status, oGetter.StatusText Dim sRSS : sRSS = oGetter.responseText WScript.Echo Left( sRSS, 45 ) Dim oXMLDOC : Set oXMLDOC = CreateObject( "MSXML2.DOMDocument" ) ' sRSS = Left( sRSS, Len( sRSS ) - 10 ) ' if you want to see an parseError Dim bOk : bOk = oXMLDOC.loadXML( sRSS ) If bOk Then WScript.Echo "ok" Else WScript.Echo "not ok" WScript.Echo oXMLDOC.parseError.reason End If Else WScript.Echo "sGetter: Some Problems" WScript.Echo nErr, sErr End If WScript.Echo "--------------------" Next WScript.Quit 0 output (e.g.): cscript GetRssXml.vbs Getter WinHttp.WinHttpRequest.5.1 200 OK <?xml version="1.0" encoding="windows-1255"?> ok -------------------- Getter MSXML2.XMLHTTP 200 OK <?xml version="1.0" encoding="windows-1255"?> not ok An invalid character was found in text content. -------------------- on different W2K and XP computers - with different version of XMLHTTP and DomDocument - and always had failures with the second getter. I must admit, that I couldn't test it server side (.asp) - no server - and that I don't know if the DomDoc tree is usable, but I *think* that using WinHttpRequest.5.1 will give you a chance to solve your problem. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| display unicode (utf-8) files in Windows Console | PowerShell | |||
| Bulk Convert .TXT Files to Unicode | VB Script | |||
| Call function with parameters that also call functions (.Net and P | PowerShell | |||
| Windows Vista: How do I convert WMM files to .wmv? | Vista music pictures video | |||
| convert pab to csv for import into windows mail | Vista mail | |||