aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rexml/encodings/ICONV.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml/encodings/ICONV.rb')
-rw-r--r--lib/rexml/encodings/ICONV.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/rexml/encodings/ICONV.rb b/lib/rexml/encodings/ICONV.rb
new file mode 100644
index 0000000000..f1b5c80b87
--- /dev/null
+++ b/lib/rexml/encodings/ICONV.rb
@@ -0,0 +1,14 @@
+require "iconv"
+raise LoadError unless defined? Iconv
+
+module REXML
+ module Encoding
+ def decode( str )
+ return Iconv::iconv(UTF_8, @encoding, str)[0]
+ end
+
+ def encode( content )
+ return Iconv::iconv(@encoding, UTF_8, content)[0]
+ end
+ end
+end