diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-28 14:52:21 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-28 14:52:21 +0000 |
commit | 718813ca9b2228274b32a9119023074be116fe9b (patch) | |
tree | 657746efc41a8c6e4dbb30248db8e127f1f15932 /lib/rexml/encoding.rb | |
parent | 7ba54654a5f102be085bda53d4f117dfc0b06d8f (diff) |
* lib/rexml/source.rb: Move encoding detection code to base class.
* lib/rexml/encoding.rb: Remove needless encoding detection code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/encoding.rb')
-rw-r--r-- | lib/rexml/encoding.rb | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb index d1d5172841..2863af9147 100644 --- a/lib/rexml/encoding.rb +++ b/lib/rexml/encoding.rb @@ -20,19 +20,6 @@ module REXML true end - def check_encoding(xml) - # We have to recognize UTF-16BE, UTF-16LE, and UTF-8 - if xml[0, 2] == "\xfe\xff" - xml[0, 2] = "" - return 'UTF-16BE' - elsif xml[0, 2] == "\xff\xfe" - xml[0, 2] = "" - return 'UTF-16LE' - end - xml =~ /^\s*<\?xml\s+version\s*=\s*(['"]).*?\1\s+encoding\s*=\s*(["'])(.*?)\2/m - return $3 ? $3.upcase : 'UTF-8' - end - def encode(string) string.encode(@encoding) end |