summaryrefslogtreecommitdiff
path: root/lib/rexml/encodings/EUC-JP.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml/encodings/EUC-JP.rb')
-rw-r--r--lib/rexml/encodings/EUC-JP.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/rexml/encodings/EUC-JP.rb b/lib/rexml/encodings/EUC-JP.rb
index def760b303..8b146e5f0a 100644
--- a/lib/rexml/encodings/EUC-JP.rb
+++ b/lib/rexml/encodings/EUC-JP.rb
@@ -3,30 +3,30 @@ begin
module REXML
module Encoding
- def from_euc_jp(str)
+ def decode(str)
return Uconv::euctou8(str)
end
- def to_euc_jp content
+ def encode content
return Uconv::u8toeuc(content)
end
end
end
rescue LoadError
begin
- require 'iconv'
- module REXML
- module Encoding
- def from_euc_jp(str)
- return Iconv::iconv("utf-8", "euc-jp", str).join('')
- end
+ require 'iconv'
+ module REXML
+ module Encoding
+ def decode(str)
+ return Iconv::iconv("utf-8", "euc-jp", str)[0]
+ end
- def to_euc_jp content
- return Iconv::iconv("euc-jp", "utf-8", content).join('')
+ def encode content
+ return Iconv::iconv("euc-jp", "utf-8", content)[0]
+ end
end
end
- end
rescue LoadError
- raise "uconv or iconv is required for Japanese encoding support."
+ raise "uconv or iconv is required for Japanese encoding support."
end
end