|
From: | noreply |
Subject: | [myexperiment-hackers] [3443] trunk/lib/country_codes.rb: only force encoding of country codes if ruby is newer than 1.8.7 |
Date: | Fri, 22 Feb 2013 21:40:16 +0000 (UTC) |
only force encoding of country codes if ruby is newer than 1.8.7
--- trunk/lib/country_codes.rb 2013-02-22 19:37:09 UTC (rev 3442)
+++ trunk/lib/country_codes.rb 2013-02-22 21:40:16 UTC (rev 3443)
@@ -1,7 +1,8 @@
module CountryCodes
@@codes = Hash.new
File.open('config/countries.tab').each do |record|
- parts = record.force_encoding('iso-8859-1').split("\t")
+ record = record.force_encoding('iso-8859-1') if RUBY_VERSION > "1.8.7"
+ parts = record.split("\t")
@@codes[parts[0]] = parts[1].strip
end
[Prev in Thread] | Current Thread | [Next in Thread] |