[#42643] メールのSMTP認証の方法(質問) — "Hisashi Yahata" <yahatah@...>

お世話になります。

34 messages 2006/08/09
[#42649] Re: メールのSMTP認証の方法(質問) — OHARA Shigeki <os@...> 2006/08/09

大原です。

[#42650] Re: メールのSMTP認証の方法(質問) — "Hisashi Yahata" <yahatah@...> 2006/08/09

大原様

[#42651] Re: メールのSMTP認証の方法(質問) — 植田裕之 <ueda@...> 2006/08/09

植田と申します。

[#42654] Re: メールのSMTP認証の方法(質問) — "Hisashi Yahata" <yahatah@...> 2006/08/09

植田 裕之様

[#42657] Re: メールのSMTP認証の方法(質問) — WATANABE Tetsuya <Tetsuya.WATANABE@...> 2006/08/09

渡辺哲也です。

[ruby-list:42743] Re: rexmlでのUTF-16の扱いについて

From: nobu@...
Date: 2006-08-22 13:43:11 UTC
List: ruby-list #42743
なかだです。

At Tue, 22 Aug 2006 17:05:29 +0900,
石田 三英 wrote in [ruby-list:42737]:
> UTF-16でエンコーディングされたxmlファイルを
> 次のように読み込むと、下記のようなエラーとなります。
> UTF-8、euc-jp でエンコードされたxmlファイルは問題ないのですが、
> 何が足りないのでしょうか?

rexmlのバグです。BOMがあるときにencodingsをrequireしていません。

# しかし、ほんとにrubyっぽくないソースだな。 > rexml


Index: lib/rexml/encoding.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/rexml/encoding.rb,v
retrieving revision 1.5.2.3
diff -p -u -2 -r1.5.2.3 encoding.rb
--- lib/rexml/encoding.rb	14 Apr 2006 02:56:43 -0000	1.5.2.3
+++ lib/rexml/encoding.rb	22 Aug 2006 13:23:48 -0000
@@ -55,6 +55,6 @@ 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
Index: lib/rexml/source.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/rexml/source.rb,v
retrieving revision 1.4.2.6
diff -p -u -2 -r1.4.2.6 source.rb
--- lib/rexml/source.rb	14 Apr 2006 02:56:43 -0000	1.4.2.6
+++ lib/rexml/source.rb	22 Aug 2006 13:29:48 -0000
@@ -136,6 +136,6 @@ module REXML
       # 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


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread