[#37050] [Feature #735] Date#inspect — "rubikitch ." <redmine@...>

Feature #735: Date#inspect

14 messages 2008/11/09

[#37075] [Feature #747] /\A/u ignores BOM — Shyouhei Urabe <redmine@...>

Feature #747: /\A/u ignores BOM

14 messages 2008/11/12

[#37161] m17n of irb — "Yugui (Yuki Sonoda)" <yugui@...>

Yuguiです。

35 messages 2008/11/24
[#37183] Re: m17n of irb — keiju@... (keiju ISHITSUKA) 2008/11/25

けいじゅ@いしつかです.

[#37203] Re: m17n of irb — "Yugui (Yuki Sonoda)" <yugui@...> 2008/11/26

keiju ISHITSUKA さんは書きました:

[#37292] Re: m17n of irb — Yukihiro Matsumoto <matz@...> 2008/12/06

まつもと ゆきひろです

[#37293] Re: m17n of irb — "Yugui (Yuki Sonoda)" <yugui@...> 2008/12/07

Yuguiです。

[#37298] Re: m17n of irb — Yukihiro Matsumoto <matz@...> 2008/12/07

まつもと ゆきひろです

[#37210] RSS::Maker.create(version) — "Akinori MUSHA" <knu@...>

 RSS::Maker で、 "2.0" 等の文字列でフィードのフォーマットを渡す

15 messages 2008/11/27

[#37213] Re: [ruby-cvs:27586] Ruby:r20368 (trunk): * ext/bigdecimal/bigdecimal.c (BigDecimal_div2): should return — Tadayoshi Funaba <tadf@...>

> * ext/bigdecimal/bigdecimal.c (BigDecimal_div2): should return

8 messages 2008/11/27

[ruby-dev:37227] Re: File.read ignores "rb" when ASCII incompatible encoding is specified

From: Yukihiro Matsumoto <matz@...>
Date: 2008-11-28 15:57:09 UTC
List: ruby-dev #37227
まつもと ゆきひろです

In message "Re: [ruby-dev:37226] File.read ignores "rb" when ASCII incompatible encoding is specified"
    on Fri, 28 Nov 2008 23:28:54 +0900, "Yusuke ENDOH" <mame@tsg.ne.jp> writes:

|以下の挙動は意図的でしょうか。
|
|$ ./ruby -ve 'File.read("foo", "rb", :encoding => "UTF-16LE")'
|ruby 1.9.0 (2008-11-28 revision 20387) [i686-linux]
|-e:1:in `read': ASCII incompatible encoding needs binmode (ArgumentError)
|        from -e:1:in `<main>'

ある意味、意図的です。File.readの引数は

   IO.read(name, [length [, offset]], open_args)   => string

なので、第2引数で指定しているのはmodeではなく読み込む文字列の
長さだからです。ここではlengthのタイプチェックよりも先にエン
コーディングのチェックが入っているので気づきにくいですが、
encoding指定を削ると

  -e:1:in `read': can't convert String into Integer (TypeError)

というエラーが出てちょっとはわかりやすいと思います。

|:mode => "rb" とすればエラーは出ません。
|
|$ ./ruby -ve 'File.read("foo", :mode => "rb", :encoding => "UTF-16LE")'
|ruby 1.9.0 (2008-11-28 revision 20387) [i686-linux]

こちらはちゃんとmodeを指定しているのでエラーが出ないのは当然
ですね。

                                まつもと ゆきひろ /:|)

In This Thread