From: Vilius Mock�nas on 13 Oct 2009 04:55 Hello, My task was to get some file using single HTTP GET request. So I used WinHttpRequest object to get file from http server and display its contents. I use Internet Explorer to compare how html page looks using different encodings (I think this program shows things right) So system locale in my windows XP Pro SP3 machine is set to Lithuanian( its Windows-1257(or windows Baltic) encoding) The html pages I'm dealing with are designed to look right using windows Baltic encoding - and they do when I use IE windows Baltic encoding. For example if I change encoding from Baltic to western European( I believe it's windows-1252 ? ) all my Baltic symbols becomes some kind of rubbish <- I want to emphasize this. So this is my script fragment: set o_win_http_request = createobject( "WinHttp.WinHttpRequest.5.1" ) o_win_http_request.open "GET", "http://www.lb.lt/exchange/Results.asp?S=csv&x=95171", false o_win_http_request.send() wscript.echo( o_win_http_request.responsetext ) The problem is that instead of my Baltic symbols I'm getting the same rubbish symbols as if I would be watching that page using IE western European encoding. And in this sample above file contents type is text/plain without any html markup - so I thought that this might be the problem, so I changed url to html page with good markup, and content="text/html; charset=windows-1257" and no changes - result is exactly the same. I expected that setting system locale to windows-1257 will solve the problem, but it didn't. Right output sample: Australijos doleris,AUD,1,2.1187,2009.10.14 Bulgarijos levas,BGN,1,1.7655,2009.10.14 Baltarusijos rublis,BYR,1000,0.8515,2009.10.14 Kanados doleris,CAD,1,2.2598,2009.10.14 �veicarijos frankas,CHF,1,2.2755,2009.10.14 Kinijos �enminbi juanis,CNY,10,3.4215,2009.10.14 �ekijos krona,CZK,10,1.3371,2009.10.14 Danijos krona,DKK,10,4.6379,2009.10.14 Estijos krona,EEK,10,2.2067,2009.10.14 Euras,EUR,1,3.4528,2009.10.14 Did�iosios Britanijos svaras sterling�,GBP,1,3.6813,2009.10.14 Kroatijos kuna,HRK,10,4.7403,2009.10.14 Vengrijos forintas,HUF,100,1.2904,2009.10.14 Islandijos krona,ISK,100,1.8725,2009.10.14 Japonijos jena,JPY,100,2.5927,2009.10.14 Kazachstano teng�,KZT,100,1.5491,2009.10.14 Latvijos latas,LVL,1,4.8705,2009.10.14 Moldovos l�ja,MDL,10,2.1023,2009.10.14 Norvegijos krona,NOK,10,4.1406,2009.10.14 Lenkijos zlotas,PLN,10,8.2025,2009.10.14 Rumunijos l�ja,RON,10,8.0615,2009.10.14 Rusijos rublis,RUB,100,7.9149,2009.10.14 �vedijos krona,SEK,10,3.3566,2009.10.14 Turkijos lira,TRY,1,1.6032,2009.10.14 Ukrainos grivina,UAH,10,2.8053,2009.10.14 JAV doleris,USD,1,2.3357,2009.10.14 SDR Tarptautinis valiutos fondas,XDR,1,3.7086,2009.10.14 Wrong output: Australijos doleris,AUD,1,2.1187,2009.10.14 Bulgarijos levas,BGN,1,1.7655,2009.10.14 Baltarusijos rublis,BYR,1000,0.8515,2009.10.14 Kanados doleris,CAD,1,2.2598,2009.10.14 ?veicarijos frankas,CHF,1,2.2755,2009.10.14 Kinijos ?enminbi juanis,CNY,10,3.4215,2009.10.14 ?ekijos krona,CZK,10,1.3371,2009.10.14 Danijos krona,DKK,10,4.6379,2009.10.14 Estijos krona,EEK,10,2.2067,2009.10.14 Euras,EUR,1,3.4528,2009.10.14 Did?iosios Britanijos svaras sterling�,GBP,1,3.6813,2009.10.14 Kroatijos kuna,HRK,10,4.7403,2009.10.14 Vengrijos forintas,HUF,100,1.2904,2009.10.14 Islandijos krona,ISK,100,1.8725,2009.10.14 Japonijos jena,JPY,100,2.5927,2009.10.14 Kazachstano teng?,KZT,100,1.5491,2009.10.14 Latvijos latas,LVL,1,4.8705,2009.10.14 Moldovos l?ja,MDL,10,2.1023,2009.10.14 Norvegijos krona,NOK,10,4.1406,2009.10.14 Lenkijos zlotas,PLN,10,8.2025,2009.10.14 Rumunijos l?ja,RON,10,8.0615,2009.10.14 Rusijos rublis,RUB,100,7.9149,2009.10.14 ?vedijos krona,SEK,10,3.3566,2009.10.14 Turkijos lira,TRY,1,1.6032,2009.10.14 Ukrainos grivina,UAH,10,2.8053,2009.10.14 JAV doleris,USD,1,2.3357,2009.10.14 SDR Tarptautinis valiutos fondas,XDR,1,3.7086,2009.10.14 Where could be the problem ? thanks in advance Vilius
From: Vilius Mock�nas on 13 Oct 2009 04:59 Rubbish syblols are not the same in this message as in my real example. Please use IE to check real rubbish symbols. V "Vilius Mock�nas" <v_mockunas(a)yahoo.com> wrote in message news:eiN5VL%23SKHA.4048(a)TK2MSFTNGP05.phx.gbl... > Hello, > > My task was to get some file using single HTTP GET request. > So I used WinHttpRequest object to get file from http server and display > its contents. > > I use Internet Explorer to compare how html page looks using different > encodings (I think this program shows things right) > So system locale in my windows XP Pro SP3 machine is set to Lithuanian( > its Windows-1257(or windows Baltic) encoding) > The html pages I'm dealing with are designed to look right using windows > Baltic encoding - and they do when I use IE windows Baltic encoding. For > example if I change encoding from Baltic to western European( I believe > it's windows-1252 ? ) all my Baltic symbols becomes some kind of rubbish > <- I want to emphasize this. > > So this is my script fragment: > > set o_win_http_request = createobject( "WinHttp.WinHttpRequest.5.1" ) > o_win_http_request.open "GET", > "http://www.lb.lt/exchange/Results.asp?S=csv&x=95171", false > o_win_http_request.send() > wscript.echo( o_win_http_request.responsetext ) > > The problem is that instead of my Baltic symbols I'm getting the same > rubbish symbols as if I would be watching that page using IE western > European encoding. And in this sample above file contents type is > text/plain without any html markup - so I thought that this might be the > problem, so I changed url to html page with good markup, and > content="text/html; charset=windows-1257" and no changes - result is > exactly the same. I expected that setting system locale to windows-1257 > will solve the problem, but it didn't. > > Right output sample: > Australijos doleris,AUD,1,2.1187,2009.10.14 > Bulgarijos levas,BGN,1,1.7655,2009.10.14 > Baltarusijos rublis,BYR,1000,0.8515,2009.10.14 > Kanados doleris,CAD,1,2.2598,2009.10.14 > �veicarijos frankas,CHF,1,2.2755,2009.10.14 > Kinijos �enminbi juanis,CNY,10,3.4215,2009.10.14 > �ekijos krona,CZK,10,1.3371,2009.10.14 > Danijos krona,DKK,10,4.6379,2009.10.14 > Estijos krona,EEK,10,2.2067,2009.10.14 > Euras,EUR,1,3.4528,2009.10.14 > Did�iosios Britanijos svaras sterling�,GBP,1,3.6813,2009.10.14 > Kroatijos kuna,HRK,10,4.7403,2009.10.14 > Vengrijos forintas,HUF,100,1.2904,2009.10.14 > Islandijos krona,ISK,100,1.8725,2009.10.14 > Japonijos jena,JPY,100,2.5927,2009.10.14 > Kazachstano teng�,KZT,100,1.5491,2009.10.14 > Latvijos latas,LVL,1,4.8705,2009.10.14 > Moldovos l�ja,MDL,10,2.1023,2009.10.14 > Norvegijos krona,NOK,10,4.1406,2009.10.14 > Lenkijos zlotas,PLN,10,8.2025,2009.10.14 > Rumunijos l�ja,RON,10,8.0615,2009.10.14 > Rusijos rublis,RUB,100,7.9149,2009.10.14 > �vedijos krona,SEK,10,3.3566,2009.10.14 > Turkijos lira,TRY,1,1.6032,2009.10.14 > Ukrainos grivina,UAH,10,2.8053,2009.10.14 > JAV doleris,USD,1,2.3357,2009.10.14 > SDR Tarptautinis valiutos fondas,XDR,1,3.7086,2009.10.14 > > Wrong output: > Australijos doleris,AUD,1,2.1187,2009.10.14 > Bulgarijos levas,BGN,1,1.7655,2009.10.14 > Baltarusijos rublis,BYR,1000,0.8515,2009.10.14 > Kanados doleris,CAD,1,2.2598,2009.10.14 > ?veicarijos frankas,CHF,1,2.2755,2009.10.14 > Kinijos ?enminbi juanis,CNY,10,3.4215,2009.10.14 > ?ekijos krona,CZK,10,1.3371,2009.10.14 > Danijos krona,DKK,10,4.6379,2009.10.14 > Estijos krona,EEK,10,2.2067,2009.10.14 > Euras,EUR,1,3.4528,2009.10.14 > Did?iosios Britanijos svaras sterling�,GBP,1,3.6813,2009.10.14 > Kroatijos kuna,HRK,10,4.7403,2009.10.14 > Vengrijos forintas,HUF,100,1.2904,2009.10.14 > Islandijos krona,ISK,100,1.8725,2009.10.14 > Japonijos jena,JPY,100,2.5927,2009.10.14 > Kazachstano teng?,KZT,100,1.5491,2009.10.14 > Latvijos latas,LVL,1,4.8705,2009.10.14 > Moldovos l?ja,MDL,10,2.1023,2009.10.14 > Norvegijos krona,NOK,10,4.1406,2009.10.14 > Lenkijos zlotas,PLN,10,8.2025,2009.10.14 > Rumunijos l?ja,RON,10,8.0615,2009.10.14 > Rusijos rublis,RUB,100,7.9149,2009.10.14 > ?vedijos krona,SEK,10,3.3566,2009.10.14 > Turkijos lira,TRY,1,1.6032,2009.10.14 > Ukrainos grivina,UAH,10,2.8053,2009.10.14 > JAV doleris,USD,1,2.3357,2009.10.14 > SDR Tarptautinis valiutos fondas,XDR,1,3.7086,2009.10.14 > > Where could be the problem ? > > > thanks in advance > Vilius > >
From: Paul Randall on 14 Oct 2009 00:26 "Vilius Mock�nas" <v_mockunas(a)yahoo.com> wrote in message news:eiN5VL%23SKHA.4048(a)TK2MSFTNGP05.phx.gbl... > Hello, > > My task was to get some file using single HTTP GET request. > So I used WinHttpRequest object to get file from http server and display > its contents. > > I use Internet Explorer to compare how html page looks using different > encodings (I think this program shows things right) > So system locale in my windows XP Pro SP3 machine is set to Lithuanian( > its Windows-1257(or windows Baltic) encoding) > The html pages I'm dealing with are designed to look right using windows > Baltic encoding - and they do when I use IE windows Baltic encoding. For > example if I change encoding from Baltic to western European( I believe > it's windows-1252 ? ) all my Baltic symbols becomes some kind of rubbish > <- I want to emphasize this. > > So this is my script fragment: > > set o_win_http_request = createobject( "WinHttp.WinHttpRequest.5.1" ) > o_win_http_request.open "GET", > "http://www.lb.lt/exchange/Results.asp?S=csv&x=95171", false > o_win_http_request.send() > wscript.echo( o_win_http_request.responsetext ) > > The problem is that instead of my Baltic symbols I'm getting the same > rubbish symbols as if I would be watching that page using IE western > European encoding. And in this sample above file contents type is > text/plain without any html markup - so I thought that this might be the > problem, so I changed url to html page with good markup, and > content="text/html; charset=windows-1257" and no changes - result is > exactly the same. I expected that setting system locale to windows-1257 > will solve the problem, but it didn't. > > Right output sample: > Australijos doleris,AUD,1,2.1187,2009.10.14 > Bulgarijos levas,BGN,1,1.7655,2009.10.14 > Baltarusijos rublis,BYR,1000,0.8515,2009.10.14 > Kanados doleris,CAD,1,2.2598,2009.10.14 > �veicarijos frankas,CHF,1,2.2755,2009.10.14 > Kinijos �enminbi juanis,CNY,10,3.4215,2009.10.14 > �ekijos krona,CZK,10,1.3371,2009.10.14 > Danijos krona,DKK,10,4.6379,2009.10.14 > Estijos krona,EEK,10,2.2067,2009.10.14 > Euras,EUR,1,3.4528,2009.10.14 > Did�iosios Britanijos svaras sterling�,GBP,1,3.6813,2009.10.14 > Kroatijos kuna,HRK,10,4.7403,2009.10.14 > Vengrijos forintas,HUF,100,1.2904,2009.10.14 > Islandijos krona,ISK,100,1.8725,2009.10.14 > Japonijos jena,JPY,100,2.5927,2009.10.14 > Kazachstano teng�,KZT,100,1.5491,2009.10.14 > Latvijos latas,LVL,1,4.8705,2009.10.14 > Moldovos l�ja,MDL,10,2.1023,2009.10.14 > Norvegijos krona,NOK,10,4.1406,2009.10.14 > Lenkijos zlotas,PLN,10,8.2025,2009.10.14 > Rumunijos l�ja,RON,10,8.0615,2009.10.14 > Rusijos rublis,RUB,100,7.9149,2009.10.14 > �vedijos krona,SEK,10,3.3566,2009.10.14 > Turkijos lira,TRY,1,1.6032,2009.10.14 > Ukrainos grivina,UAH,10,2.8053,2009.10.14 > JAV doleris,USD,1,2.3357,2009.10.14 > SDR Tarptautinis valiutos fondas,XDR,1,3.7086,2009.10.14 > > Wrong output: > Australijos doleris,AUD,1,2.1187,2009.10.14 > Bulgarijos levas,BGN,1,1.7655,2009.10.14 > Baltarusijos rublis,BYR,1000,0.8515,2009.10.14 > Kanados doleris,CAD,1,2.2598,2009.10.14 > ?veicarijos frankas,CHF,1,2.2755,2009.10.14 > Kinijos ?enminbi juanis,CNY,10,3.4215,2009.10.14 > ?ekijos krona,CZK,10,1.3371,2009.10.14 > Danijos krona,DKK,10,4.6379,2009.10.14 > Estijos krona,EEK,10,2.2067,2009.10.14 > Euras,EUR,1,3.4528,2009.10.14 > Did?iosios Britanijos svaras sterling�,GBP,1,3.6813,2009.10.14 > Kroatijos kuna,HRK,10,4.7403,2009.10.14 > Vengrijos forintas,HUF,100,1.2904,2009.10.14 > Islandijos krona,ISK,100,1.8725,2009.10.14 > Japonijos jena,JPY,100,2.5927,2009.10.14 > Kazachstano teng?,KZT,100,1.5491,2009.10.14 > Latvijos latas,LVL,1,4.8705,2009.10.14 > Moldovos l?ja,MDL,10,2.1023,2009.10.14 > Norvegijos krona,NOK,10,4.1406,2009.10.14 > Lenkijos zlotas,PLN,10,8.2025,2009.10.14 > Rumunijos l?ja,RON,10,8.0615,2009.10.14 > Rusijos rublis,RUB,100,7.9149,2009.10.14 > ?vedijos krona,SEK,10,3.3566,2009.10.14 > Turkijos lira,TRY,1,1.6032,2009.10.14 > Ukrainos grivina,UAH,10,2.8053,2009.10.14 > JAV doleris,USD,1,2.3357,2009.10.14 > SDR Tarptautinis valiutos fondas,XDR,1,3.7086,2009.10.14 > > Where could be the problem ? I haven't played with this encoding stuff for a long time. I'm guessing that o_win_http_request.responsetext actually contains the data you want, but in the handoff to wscript.echo, a locale translation occurs which causes the replacement of certain characters with a question mark (?). Have you tried using the routine posted by Tom Lavedas in your thread entitled "Script to output single HTTP GET ?" ? Did you do a hex dump of the downloaded file and verify whether the translation to '?' occurred or not? -Paul Randall
|
Pages: 1 Prev: How to get IP address and Host Name Next: Print a Text file |