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

[sup-devel] [PATCH 06/10] add String#transcode



---
 lib/sup/util.rb |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index 560ac73..c27e527 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -319,6 +319,10 @@ class String
     out.force_encoding Encoding::UTF_8 if out.respond_to? :force_encoding
     out
   end
+
+  def transcode src_encoding=$encoding
+    Iconv.easy_decode $encoding, src_encoding, self
+  end
 end
 
 class Numeric
-- 
1.6.3.3

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel