summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-23 12:45:17 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-23 12:45:17 +0000
commit1f849b54fbddd015cf77e05364e494157f16e4d8 (patch)
tree169281da9ed144fe291bea53316a287aa5c54638
parent57eb3170450a0374dd17b30eb77a26ee4560019a (diff)
merges r30112 from trunk into ruby_1_9_2.
-- * ext/nkf/lib/kconv.rb (String#kconv): fix typo and update rdoc. patched by Kouhei Yanagita [ruby-dev:42696] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/nkf/lib/kconv.rb10
-rw-r--r--test/nkf/test_kconv.rb7
-rw-r--r--version.h2
4 files changed, 18 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 43c49c8ce9..8d46209839 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Dec 7 18:56:52 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/lib/kconv.rb (String#kconv): fix typo and update rdoc.
+ patched by Kouhei Yanagita [ruby-dev:42696]
+
Tue Dec 7 00:27:14 2010 Masaya Tarui <tarui@ruby-lnag.org>
* win32/win32.c (rb_w32_read): fixed more for readline,
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
index 6230996876..f8c1ae8f59 100644
--- a/ext/nkf/lib/kconv.rb
+++ b/ext/nkf/lib/kconv.rb
@@ -51,8 +51,8 @@ module Kconv
# call-seq:
# Kconv.kconv(str, to_enc, from_enc=nil)
#
- # Convert <code>str</code> to out_code.
- # <code>out_code</code> and <code>in_code</code> are given as constants of Kconv.
+ # Convert <code>str</code> to <code>to_enc</code>.
+ # <code>to_enc</code> and <code>from_enc</code> 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 @@ class String
# call-seq:
# String#kconv(to_enc, from_enc)
#
- # Convert <code>self</code> to out_code.
- # <code>out_code</code> and <code>in_code</code> are given as constants of Kconv.
+ # Convert <code>self</code> to <code>to_enc</code>.
+ # <code>to_enc</code> and <code>from_enc</code> 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
diff --git a/test/nkf/test_kconv.rb b/test/nkf/test_kconv.rb
index 8581f10e4e..09c0ce803a 100644
--- a/test/nkf/test_kconv.rb
+++ b/test/nkf/test_kconv.rb
@@ -71,4 +71,11 @@ class TestKconv < Test::Unit::TestCase
assert_equal(@jis_str, @utf8_str.kconv(::NKF::JIS))
assert_equal(@jis_str, @jis_str.kconv(::NKF::JIS))
end
+ def test_kconv
+ str = "\xc2\xa1"
+ %w/UTF-8 EUC-JP/.each do |enc|
+ s = str.dup.force_encoding(enc)
+ assert_equal(s, s.kconv(enc))
+ end
+ end
end
diff --git a/version.h b/version.h
index 9a165eec67..172a4bf117 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 120
+#define RUBY_PATCHLEVEL 121
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1