[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: nuby: can't get an image via http
From:       Emmanuel Touzery <emmanuel.touzery () wanadoo ! fr>
Date:       2004-01-27 17:28:27
Message-ID: 200401271823.35269.emmanuel.touzery () wanadoo ! fr
[Download RAW message or body]

Hello,

I confirm that the code i posted in the previous message (and that I repost 
here) works under linux. the fact it doesn't work under windows is definitely 
related to the binary flag of the files. maybe it's a bug in open-uri that 
the file is not in binary mode?
setting it when I get it using "binmode" doesn't seem to help :O(

===============
require 'open-uri'

mapfile = File.open('map.png', 'wb')
open('http://ras.chizumaru.com/ncg/tcmap.dll?id=NCZ&PASS=NewCZPrtT&X=129374719&Y=103205254&LV=3&WID=650&HEI=680&SZ=PRT_T&TAB=live2003_scl&FUNC=2') \
 {|f|
    f.binmode
    mapfile.write f.read
}
mapfile.close
==============


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic