diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-25 13:32:39 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-25 13:32:39 +0000 |
| commit | dc1bc25bb2cbb7e0c9fd1c9fa22bde82d595b09e (patch) | |
| tree | a3392287fb7de9bb2cd2da9ac4141131f1f39273 /lib/rexml/encoding.rb | |
| parent | 962545f8c34346349f1dfde99f7d3e6acb4c97db (diff) | |
| download | ruby-dc1bc25bb2cbb7e0c9fd1c9fa22bde82d595b09e.tar.gz ruby-dc1bc25bb2cbb7e0c9fd1c9fa22bde82d595b09e.tar.xz ruby-dc1bc25bb2cbb7e0c9fd1c9fa22bde82d595b09e.zip | |
* lib/rexml/source.rb (REXML::IOSource#initialize): encoding have to
be set with the accessor. fixed: [ruby-list:42737]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/encoding.rb')
| -rw-r--r-- | lib/rexml/encoding.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb index 644957439..8acc8a369 100644 --- a/lib/rexml/encoding.rb +++ b/lib/rexml/encoding.rb @@ -54,8 +54,8 @@ module REXML def check_encoding str # We have to recognize UTF-16, LSB UTF-16, and UTF-8 - return UTF_16 if str[0] == 254 && str[1] == 255 - return UNILE if str[0] == 255 && str[1] == 254 + return UTF_16 if /\A\xfe\xff/n =~ str + return UNILE if /\A\xff\xfe/n =~ str str =~ /^\s*<?xml\s*version=(['"]).*?\2\s*encoding=(["'])(.*?)\2/um return $1.upcase if $1 return UTF_8 |
