[#41278] [BUG:1.9] BINARY should not be ASCII-compatible — Yugui <yugui@...>

Yuguiです。

15 messages 2010/05/11

[#41407] [Bug #3339] win32ole test failure — Usaku NAKAMURA <redmine@...>

Bug #3339: win32ole test failure

20 messages 2010/05/25
[#41411] Re: [Bug #3339] win32ole test failure — Masaki Suketa <masaki.suketa@...> 2010/05/25

助田です。

[#41412] Re: [Bug #3339] win32ole test failure — "U.Nakamura" <usa@...> 2010/05/25

こんにちは、なかむら(う)です。

[ruby-dev:41452] [Bug #3360] rdoc fails when including BOM

From: white leaf <redmine@...>
Date: 2010-05-28 17:17:33 UTC
List: ruby-dev #41452
Bug #3360: rdoc fails when including BOM
http://redmine.ruby-lang.org/issues/show/3360

起票者: white leaf
ステータス: Open, 優先度: Normal
ruby -v: ruby 1.9.3dev (2010-05-28 trunk 28052) [i386-cygwin]

whiteleaf と申します。

BOM を含むファイルを rdoc にかけると処理が固まります。
rdoc が BOM を見てないせいなので、以下のパッチでなおりました。

・":bom|utf-8" オプションを使っていないのは 1.8 のためと
 結局 ASCII-8BIT に force_encoding しないといけないため意味がないからです。
 (rdoc のエンコーディングを UTF-8 にするなら別ですが)
・UTF-8 の BOM しか見ていないのは ruby スクリプトに使わない(使えない)
 ので意味がないからです。
・encode してるのは複数のファイルが異なるエンコーディングを使っている場合に
 charset とエンコーディングが異なる可能性があるためです。

# 余談ですが、bom|utf-* オプションはエンコーディングが未知の場合には
# ほとんど意味が無いなあと思いました。


Index: generator/template/darkfish/classpage.rhtml
===================================================================
--- generator/template/darkfish/classpage.rhtml	(リビジョン 28052)
+++ generator/template/darkfish/classpage.rhtml	(作業コピー)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="<%= @options.charset %>"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Index: rdoc.rb
===================================================================
--- rdoc.rb	(リビジョン 28052)
+++ rdoc.rb	(作業コピー)
@@ -404,12 +404,17 @@
   end
 
   def read_file_contents(filename)
+    utf8_bom = [0xEF, 0xBB, 0xBF].pack("C*")
     content = open filename, "rb" do |f| f.read end
 
+    if content[0..2] == utf8_bom then
+      content = content[3..-1]
+    end
     if defined? Encoding then
       if /coding[=:]\s*([^\s;]+)/i =~ content[%r"\A(?:#!.*\n)?.*\n"]
         if enc = ::Encoding.find($1)
           content.force_encoding(enc)
+          content.encode!(@options.charset)
         end
       end
     end


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next