From dc3edc0089dfc94bb378dc3a628d06bdfcce2eca Mon Sep 17 00:00:00 2001 From: Andrew Horton Date: Sat, 6 Aug 2011 02:24:23 +1200 Subject: [PATCH] Made country plugin ruby1.9 safe --- plugins/country-codes.txt | 2 +- plugins/country.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/country-codes.txt b/plugins/country-codes.txt index d7eef432..736eb468 100644 --- a/plugins/country-codes.txt +++ b/plugins/country-codes.txt @@ -250,5 +250,5 @@ WESTERN SAHARA,EH,ESH,AFRINIC YEMEN,YE,YEM,RIPE ZAMBIA,ZM,ZMB,AFRINIC ZIMBABWE,ZW,ZWE,AFRINIC -ÅLAND ISLANDS,AX,ALA,RIPE +Ã…LAND ISLANDS,AX,ALA,RIPE SAINT MARTIN,MF,MAF,ARIN diff --git a/plugins/country.rb b/plugins/country.rb index fa2ffb27..7eb75b00 100644 --- a/plugins/country.rb +++ b/plugins/country.rb @@ -61,7 +61,10 @@ def startup f = whatweb_folder + "/country-codes.txt" @ccnames={}; - File.read(f).each {|line| x=line.split(","); @ccnames[x[1]] = x[0] } + File.open(f,"r:UTF-8").read.split.each do |line| + x=line.split(","); + @ccnames[x[1]] = x[0] + end end def passive