diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-22 15:25:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-22 15:25:43 +0000 |
commit | 319d2b185be7dda1fc9778da3039e12d347e5e72 (patch) | |
tree | 5969a8232a64d3e035ec7d5f7949f2bce8280cee /lib/rexml/source.rb | |
parent | 4da7e2b955a6f8f794c646c452e19fa46370baf3 (diff) |
* lib/rexml/source.rb (REXML::IOSource#initialize): encoding have to
be set with the accessor. fixed: [ruby-list:42737]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/source.rb')
-rw-r--r-- | lib/rexml/source.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb index cacab221db..c51f504811 100644 --- a/lib/rexml/source.rb +++ b/lib/rexml/source.rb @@ -135,14 +135,14 @@ module REXML # the XML spec. If there is one, we can determine the encoding from # it. str = @source.read( 2 ) - if (str[0] == 254 && str[1] == 255) || (str[0] == 255 && str[1] == 254) - @encoding = check_encoding( str ) + if /\A(?:\xfe\xff|\xff\xfe)/n =~ str + self.encoding = check_encoding( str ) @line_break = encode( '>' ) else @line_break = '>' end super [email protected]( @line_break ) - end + end def scan(pattern, cons=false) rv = super |