Project

General

Profile

Actions

Bug #4128

closed

String#kconvでfrom_encを指定していないときにString#encodingを使うようになっていない

Added by kyanagi (Kouhei Yanagita) over 14 years ago. Updated about 14 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3dev (2010-12-06 trunk 30091) [i686-linux]
Backport:
[ruby-dev:42696]

Description

=begin
typoがあり、意図した通りの動作になっていません。

あと、コメントが古かったので修正してみました。

Index: ext/nkf/lib/kconv.rb

--- ext/nkf/lib/kconv.rb (リビジョン 30091)
+++ ext/nkf/lib/kconv.rb (作業コピー)
@@ -200,9 +200,9 @@
# String#kconv(to_enc, from_enc)
#
# Convert self to out_code.

  • out_code and in_code are given as constants of Kconv.

  • to_enc and from_enc are given as constants of Kconv or Encoding objects.

    def kconv(to_enc, from_enc=nil)
  • form_enc = self.encoding if !from_enc && self.encoding != Encoding.list[0]
  • from_enc = self.encoding if !from_enc && self.encoding != Encoding.list[0]
    Kconv::kconv(self, to_enc, from_enc)
    end
    =end
Actions #1

Updated by kyanagi (Kouhei Yanagita) over 14 years ago

=begin
その上の方にも直すべきコメントがありましたのでパッチを送り直します。

Index: ext/nkf/lib/kconv.rb

--- ext/nkf/lib/kconv.rb (リビジョン 30091)
+++ ext/nkf/lib/kconv.rb (作業コピー)
@@ -51,8 +51,8 @@
# call-seq:
# Kconv.kconv(str, to_enc, from_enc=nil)
#

  • Convert str to out_code.

  • out_code and in_code are given as constants of Kconv.

  • Convert str to to_enc.

  • to_enc and from_enc are given as constants of Kconv or Encoding objects.

    def kconv(str, to_enc, from_enc=nil)
    opt = ''
    opt += ' --ic=' + from_enc.to_s if from_enc
    @@ -199,10 +199,10 @@

    call-seq:

    String#kconv(to_enc, from_enc)

  • Convert self to out_code.

  • out_code and in_code are given as constants of Kconv.

  • Convert self to to_enc.

  • to_enc and from_enc are given as constants of Kconv or Encoding objects.

    def kconv(to_enc, from_enc=nil)
  • form_enc = self.encoding if !from_enc && self.encoding != Encoding.list[0]
  • from_enc = self.encoding if !from_enc && self.encoding != Encoding.list[0]
    Kconv::kconv(self, to_enc, from_enc)
    end

=end

Actions #2

Updated by naruse (Yui NARUSE) over 14 years ago

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

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

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0