Thursday, 12 September 2013

Ruby windows-1250 encoding

Ruby windows-1250 encoding

I'm trying to get data from site with charset windows-1250 I have this code:
require 'open-uri'
p
open('http://www.ceskybenzin.cz/mapa/0').read.force_encoding('Windows-1250').encode('UTF-8').scan
/addMarker\( point, '(.*?) - (.*?) - (.*?) - (.*?)', 'green', (.*?),
bublina, 0 \);/
and I'm getting data like:
["EuroOil", "Prun\u00E9\u0159ov ", "U\u0161\u00E1k", "Zat\u00EDm
nezadan\u00FD kraj", "181"]
could someone tell me how to correctly get data from windows-1250 site
Thank you

No comments:

Post a Comment