Project

General

Profile

Feature #3036

String#encode(to, from, opt) の opt[:replace] に Hash

Added by naruse (Yui NARUSE) over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Target version:

Description

=begin
[ruby-dev:40540] の String#encode(to, from, opt) の opt[:replace] に Hash の話を、
別にチケットとして起こしておきます

String#encode(to, from, opt) の opt[:replace] に Hash を与えられるようにして、
そこに、変換元 encoding の文字 => 変換先の文字、という未定義文字の fallback 変換表を与えられるようにする、
というものを今考えています。
これだと例えば、
fallbacks = {
?¥uE6AD => "[ふくろ]",
?¥u{1F4BA} => "[いす]"
}
"¥u{3042 E6AD 1F4BA}".encode("UTF8-KDDI", replace: fallbacks) #=> "あ[ふくろ][いす]"
=end

Associated revisions

Revision 27326
Added by naruse (Yui NARUSE) over 9 years ago

  • transcode.c (transcode_loop): insert output the value when
    fallback hash has a related key. [ruby-dev:40540]
    [ruby-dev:40829] #3036

  • transcode.c (rb_econv_prepare_opts): pass to newhash
    a value with the key :fallback.

Revision 27326
Added by naruse (Yui NARUSE) over 9 years ago

  • transcode.c (transcode_loop): insert output the value when
    fallback hash has a related key. [ruby-dev:40540]
    [ruby-dev:40829] #3036

  • transcode.c (rb_econv_prepare_opts): pass to newhash
    a value with the key :fallback.

Revision 27326
Added by naruse (Yui NARUSE) over 9 years ago

  • transcode.c (transcode_loop): insert output the value when
    fallback hash has a related key. [ruby-dev:40540]
    [ruby-dev:40829] #3036

  • transcode.c (rb_econv_prepare_opts): pass to newhash
    a value with the key :fallback.

Revision 27326
Added by naruse (Yui NARUSE) over 9 years ago

  • transcode.c (transcode_loop): insert output the value when
    fallback hash has a related key. [ruby-dev:40540]
    [ruby-dev:40829] #3036

  • transcode.c (rb_econv_prepare_opts): pass to newhash
    a value with the key :fallback.

Revision 27326
Added by naruse (Yui NARUSE) over 9 years ago

  • transcode.c (transcode_loop): insert output the value when
    fallback hash has a related key. [ruby-dev:40540]
    [ruby-dev:40829] #3036

  • transcode.c (rb_econv_prepare_opts): pass to newhash
    a value with the key :fallback.

Revision 27326
Added by naruse (Yui NARUSE) over 9 years ago

  • transcode.c (transcode_loop): insert output the value when
    fallback hash has a related key. [ruby-dev:40540]
    [ruby-dev:40829] #3036

  • transcode.c (rb_econv_prepare_opts): pass to newhash
    a value with the key :fallback.

History

#1

Updated by naruse (Yui NARUSE) over 9 years ago

  • Target version set to 1.9.2

=begin
反対がないので、1.9.2 の feature として認められたとみなします。
なお、実装を諦めた場合や、4月中にできなかった場合は 1.9.2 には入りません。
=end

#2

Updated by znz (Kazuhiro NISHIYAMA) over 9 years ago

  • Category set to core

=begin

=end

#3

Updated by naruse (Yui NARUSE) over 9 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27326.
Yui, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF