diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-17 05:23:54 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-17 05:23:54 +0000 |
| commit | a61ea1af99fafbf063b0c5b2784f4d07574eb8ed (patch) | |
| tree | 034d9e3ed468898636d9e4fd68e14d083745cccc /lib/rexml/encodings | |
| parent | aaa2313a13e20fca69fbc2a7949185d08fd37242 (diff) | |
| download | ruby-a61ea1af99fafbf063b0c5b2784f4d07574eb8ed.tar.gz ruby-a61ea1af99fafbf063b0c5b2784f4d07574eb8ed.tar.xz ruby-a61ea1af99fafbf063b0c5b2784f4d07574eb8ed.zip | |
* eval.c (ruby_init): set ruby_running to true after
initialization.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/encodings')
| -rw-r--r-- | lib/rexml/encodings/EUC-JP.rb | 4 | ||||
| -rw-r--r-- | lib/rexml/encodings/SHIFT_JIS.rb | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/rexml/encodings/EUC-JP.rb b/lib/rexml/encodings/EUC-JP.rb index 1be5663be..def760b30 100644 --- a/lib/rexml/encodings/EUC-JP.rb +++ b/lib/rexml/encodings/EUC-JP.rb @@ -18,11 +18,11 @@ rescue LoadError module REXML module Encoding def from_euc_jp(str) - return Iconv::iconv("utf-8", "euc-jp", str).join + return Iconv::iconv("utf-8", "euc-jp", str).join('') end def to_euc_jp content - return Iconv::iconv("euc-jp", "utf-8", content).join + return Iconv::iconv("euc-jp", "utf-8", content).join('') end end end diff --git a/lib/rexml/encodings/SHIFT_JIS.rb b/lib/rexml/encodings/SHIFT_JIS.rb index 865017453..27e456940 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 |
