aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rexml/encodings/SHIFT_JIS.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-17 05:23:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-17 05:23:54 +0000
commit46bf6217378e0dca4ff56446cf7233023f21778a (patch)
tree034d9e3ed468898636d9e4fd68e14d083745cccc /lib/rexml/encodings/SHIFT_JIS.rb
parent06f82d38838e3d588c96e12bf492b685ff1d8322 (diff)
downloadruby-46bf6217378e0dca4ff56446cf7233023f21778a.tar.gz
* eval.c (ruby_init): set ruby_running to true after
initialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/encodings/SHIFT_JIS.rb')
-rw-r--r--lib/rexml/encodings/SHIFT_JIS.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/rexml/encodings/SHIFT_JIS.rb b/lib/rexml/encodings/SHIFT_JIS.rb
index 8650174538..27e4569403 100644
--- a/lib/rexml/encodings/SHIFT_JIS.rb
+++ b/lib/rexml/encodings/SHIFT_JIS.rb
@@ -13,5 +13,21 @@ begin
end
end
rescue LoadError
- raise "uconv is required for Japanese encoding support."
+ begin
+ require 'iconv'
+ module REXML
+ module Encoding
+ def from_shift_jis(str)
+ return Iconv::iconv("utf-8", "shift_jis", str).join('')
+ end
+
+ def to_shift_jis content
+ return Iconv::iconv("shift_jis", "utf-8", content).join('')
+ end
+ end
+ end
+ rescue LoadError
+ raise "uconv or iconv is required for Japanese encoding support."
+ end
+
end