From 319d2b185be7dda1fc9778da3039e12d347e5e72 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 22 Aug 2006 15:25:43 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ lib/rexml/encoding.rb | 4 ++-- lib/rexml/source.rb | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e90bb25625..4d65877830 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Aug 23 00:25:14 2006 Nobuyoshi Nakada + + * lib/rexml/source.rb (REXML::IOSource#initialize): encoding have to + be set with the accessor. fixed: [ruby-list:42737] + Tue Aug 22 19:21:00 2006 Minero Aoki * lib/net/smtp.rb: parameter `to_addrs' might be an Array, diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb index 644957439e..8acc8a3698 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*' ) else @line_break = '>' end super str+@source.readline( @line_break ) - end + end def scan(pattern, cons=false) rv = super