diff options
author | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-09 17:03:32 +0000 |
---|---|---|
committer | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-09 17:03:32 +0000 |
commit | 47bd6a4f37cb14701458233479caaaf3a25397b3 (patch) | |
tree | fcbe0f686f6c9968240fffbdcbbc5c51e8e7b0eb /lib/rexml/encodings/ICONV.rb | |
parent | ff866f0a8f99cd9ea94157e73c57200baadea15c (diff) | |
download | ruby-47bd6a4f37cb14701458233479caaaf3a25397b3.tar.gz |
Applied Nobu's patch to the XML document encoding structure in REXML. It
passes all of REXML's native tests as well as a couple of others, and should
fix potential threading issues.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/encodings/ICONV.rb')
-rw-r--r-- | lib/rexml/encodings/ICONV.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/rexml/encodings/ICONV.rb b/lib/rexml/encodings/ICONV.rb index 384758d7b2..172fba7cd1 100644 --- a/lib/rexml/encodings/ICONV.rb +++ b/lib/rexml/encodings/ICONV.rb @@ -3,14 +3,20 @@ raise LoadError unless defined? Iconv module REXML module Encoding - @@__REXML_encoding_methods =<<-EOL - def decode( str ) - return Iconv::iconv("utf-8", @encoding, str)[0] + def decode_iconv(str) + Iconv.conv(UTF_8, @encoding, str) end - def encode( content ) - return Iconv::iconv(@encoding, "utf-8", content)[0] + def encode_iconv(content) + Iconv.conv(@encoding, UTF_8, content) + end + + register("ICONV") do |obj| + Iconv.conv(UTF_8, obj.encoding, nil) + class << obj + alias decode decode_iconv + alias encode encode_iconv + end end - EOL end end |