myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3443] trunk/lib/country_codes.rb: only force enc


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)

Revision
3443
Author
dgc
Date
2013-02-22 21:40:16 +0000 (Fri, 22 Feb 2013)

Log Message

only force encoding of country codes if ruby is newer than 1.8.7

Modified Paths

Diff

Modified: trunk/lib/country_codes.rb (3442 => 3443)


--- 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
     

reply via email to

[Prev in Thread] Current Thread [Next in Thread]