Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 ruby-soap4r (2.0.5-2) unstable; urgency=low
 .
   * Remove usage os iconv which is deprecated under Ruby 1.9
   * Ignore test failures on Ruby 1.8 which will go away soon.
Author: Antonio Terceiro <terceiro@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- ruby-soap4r-2.0.5.orig/lib/xsd/iconvcharset.rb
+++ ruby-soap4r-2.0.5/lib/xsd/iconvcharset.rb
@@ -5,29 +5,12 @@
 # redistribute it and/or modify it under the same terms of Ruby's license;
 # either the dual license version in 2003, or any later version.
 
-
-require 'iconv'
-
-
 module XSD
 
-
 class IconvCharset
   def self.safe_iconv(to, from, str)
-    iconv = Iconv.new(to, from)
-    out = ""
-    begin
-      out << iconv.iconv(str)
-    rescue Iconv::IllegalSequence => e
-      out << e.success
-      ch, str = e.failed.split(//, 2)
-      out << '?'
-      warn("Failed to convert #{ch}")
-      retry
-    end
-    return out
+    str.force_encoding(from).chars.map { |c| c.valid_encoding? && c || '?' }.join.encode(to)
   end
-end
-
+end if RUBY_VERSION > '1.9'
 
 end
--- /dev/null
+++ ruby-soap4r-2.0.5/test/xsd/test_iconvcharset.rb
@@ -0,0 +1,20 @@
+# encoding: UTF-8
+
+require 'test/unit'
+require 'xsd/iconvcharset'
+
+class TestIconvCharset < Test::Unit::TestCase
+
+  def test_iso88591_utf8
+    assert_equal "á", XSD::IconvCharset.safe_iconv("utf-8", "iso-8859-1", "\xE1")
+  end
+
+  def test_utf8_iso88591
+    assert_equal "\xE1".force_encoding('iso-8859-1'), XSD::IconvCharset.safe_iconv("iso-8859-1", "utf-8", "á")
+  end
+
+  def test_invalid_encoding
+    assert_equal "á?á".encode('iso-8859-1'), XSD::IconvCharset.safe_iconv("iso-8859-1", "utf-8", "á\x8Dá".force_encoding('ascii-8bit'))
+  end
+
+end if RUBY_VERSION > '1.9'
