[#47869] [Mac OS X] Dir.glob で取得したファイル名のバイト列が異なる — Watson <watson1978@...>
Ruby 2.0 までは OS X のファイル名を Dir.glob で取得したときには
7 messages
2014/01/03
[#47875] Re: [Mac OS X] Dir.glob で取得したファイル名のバイト列が異なる
— "NARUSE, Yui" <naruse@...>
2014/01/09
端的には仕様変更です。
[#47876] Re: [Mac OS X] Dir.glob で取得したファイル名のバイト列が異なる
— Watson <watson1978@...>
2014/01/09
ご返答ありがとうございます。
[#47903] Re: [ruby-cvs:51792] nobu:r44647 (trunk): socket/option.c: socket option variations — Tanaka Akira <akr@...>
2014/1/19 <nobu@ruby-lang.org>:
7 messages
2014/01/19
[#47904] Re: [ruby-cvs:51792] nobu:r44647 (trunk): socket/option.c: socket option variations
— Nobuyoshi Nakada <nobu@...>
2014/01/19
(2014/01/19 10:17), Tanaka Akira wrote:
[#47905] Re: [ruby-cvs:51792] nobu:r44647 (trunk): socket/option.c: socket option variations
— Tanaka Akira <akr@...>
2014/01/19
2014年1月19日 16:20 Nobuyoshi Nakada <nobu@ruby-lang.org>:
[#47907] Re: [ruby-cvs:51792] nobu:r44647 (trunk): socket/option.c: socket option variations
— Nobuyoshi Nakada <nobu@...>
2014/01/19
(2014/01/19 16:48), Tanaka Akira wrote:
[#47908] Re: [ruby-cvs:51792] nobu:r44647 (trunk): socket/option.c: socket option variations
— Tanaka Akira <akr@...>
2014/01/19
2014年1月19日 18:12 Nobuyoshi Nakada <nobu@ruby-lang.org>:
[#47917] Re: [ruby-changes:32633] nobu:r44712 (trunk): thread_pthread.c: get current main thread stack size — KOSAKI Motohiro <kosaki.motohiro@...>
Ruby-devに河岸をうつしました。
5 messages
2014/01/28
[#47918] Re: [ruby-changes:32633] nobu:r44712 (trunk): thread_pthread.c: get current main thread stack size
— Nobuyoshi Nakada <nobu@...>
2014/01/28
なかだです。
[#47919] Re: [ruby-changes:32633] nobu:r44712 (trunk): thread_pthread.c: get current main thread stack size
— "NARUSE, Yui" <naruse@...>
2014/01/28
スレッドのスタック情報の取得は前にまとめたことがありますが、
[ruby-dev:47934] [ruby-trunk - Bug #8445] IO.open and IO#set_enconding does not support :fallback option
From:
shibata.hiroshi@...
Date:
2014-01-30 06:17:02 UTC
List:
ruby-dev #47934
Issue #8445 has been updated by Hiroshi SHIBATA.
Target version changed from 2.1.0 to current: 2.2.0
----------------------------------------
Bug #8445: IO.open and IO#set_enconding does not support :fallback option
https://bugs.ruby-lang.org/issues/8445#change-44779
* Author: Haruhiro Yoshimoto
* Status: Assigned
* Priority: Normal
* Assignee: Akira Tanaka
* Category: M17N
* Target version: current: 2.2.0
* ruby -v: trunk(ruby 2.1.0dev)
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN
----------------------------------------
RubyDoc says that IO.open and IO#set_encoding supports optional argument defined in String#encode.
http://ruby-doc.org/core-2.0/IO.html#method-c-new-label-Options
In fact, :invalid, :undef and :replace works as expected.
However, :fallback option does not work neither for IO.open and IO#set_encoding.
Following is the example code which does not work.
f(x) is never called even if hoge.txt contains non convertible character.
File.open("./hoge.txt","r:Shift_JIS:utf-8", :fallback => lambda{|x|f(x)}){|f|
...
}
File.open("./hoge.txt"){|f|
f.set_encoding("Shift_JIS","utf-8",:fallback => lambda{|x|f(x)})
...
}
I Think this is because fill_cbuf() in io.c calls rb_econv_convert() from transcode.c directly.
On the other hand, fallback_func is called in transcode_loop(), which is called by str_encode().
Since transcode_loop() also calls rb_econv_convert(), I wrote a small patch which moves some codes from
transcode_loop() to rb_econv_convert() to fix the problem.
The attached file is the patch. Hope this helps.
---Files--------------------------------
support-fallback-for-io.patch (3.9 KB)
--
http://bugs.ruby-lang.org/