remote_table 1.1.9 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,7 @@
1
1
  if ::RUBY_VERSION >= '1.9'
2
2
  require 'ensure/encoding'
3
+ else
4
+ require 'iconv'
3
5
  end
4
6
 
5
7
  class RemoteTable
@@ -24,7 +26,7 @@ class RemoteTable
24
26
  if ::RUBY_VERSION >= '1.9'
25
27
  str.ensure_encoding 'UTF-8', :external_encoding => t.properties.encoding, :invalid_characters => :transcode
26
28
  else
27
- str
29
+ ::Iconv.conv('UTF-8//TRANSLIT', t.properties.encoding[0], str + ' ')[0..-2]
28
30
  end
29
31
  end
30
32
 
@@ -1,3 +1,3 @@
1
1
  class RemoteTable
2
- VERSION = "1.1.9"
2
+ VERSION = "1.1.10"
3
3
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'helper'
2
3
 
3
4
  class TestRemoteTable < Test::Unit::TestCase
@@ -65,4 +66,9 @@ class TestRemoteTable < Test::Unit::TestCase
65
66
  t = RemoteTable.new :url => "http://www.faa.gov/air_traffic/publications/atpubs/CNT/5-2-A.htm", :encoding => 'windows-1252', :row_xpath => '//table/tr[2]/td/table/tr', :column_xpath => 'td'
66
67
  assert t.rows.detect { |row| row['Model'] == 'A300B4600' }
67
68
  end
69
+
70
+ should %{transliterate characters into UTF-8 as long as the user provides the right encoding} do
71
+ t = RemoteTable.new :url => 'http://static.brighterplanet.com/science/data/consumables/pets/breed_genders.csv', :encoding => 'ISO-8859-1'
72
+ assert t.rows.detect { |row| row['name'] == 'Briquet Griffon Vendéen' }
73
+ end
68
74
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_table
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 9
10
- version: 1.1.9
9
+ - 10
10
+ version: 1.1.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Seamus Abshere
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-04-22 00:00:00 Z
19
+ date: 2011-05-03 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activesupport