[前][次][番号順一覧][スレッド一覧]

ruby-changes:2610

From: ko1@a...
Date: 4 Dec 2007 18:07:01 +0900
Subject: [ruby-changes:2610] naruse - Ruby:r14101 (trunk): * ext/nkf/lib/kconv.rb (tojis, tosjis, toeuc, toutf8):

naruse	2007-12-04 18:06:41 +0900 (Tue, 04 Dec 2007)

  New Revision: 14101

  Modified files:
    trunk/ChangeLog
    trunk/ext/nkf/lib/kconv.rb

  Log:
    * ext/nkf/lib/kconv.rb (tojis, tosjis, toeuc, toutf8):
      set encoding. [ruby-dev:32447]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14101&r2=14100
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/nkf/lib/kconv.rb?r1=14101&r2=14100

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14100)
+++ ChangeLog	(revision 14101)
@@ -1,3 +1,8 @@
+Tue Dec  4 17:34:17 2007  NARUSE, Yui  <naruse@r...>
+
+	* ext/nkf/lib/kconv.rb (tojis, tosjis, toeuc, toutf8):
+	  set encoding. [ruby-dev:32447]
+
 Tue Dec  4 17:07:25 2007  NARUSE, Yui  <naruse@r...>
 
 	* lib/json.rb, lib/json/*: moved to ext/json/lib.
Index: ext/nkf/lib/kconv.rb
===================================================================
--- ext/nkf/lib/kconv.rb	(revision 14100)
+++ ext/nkf/lib/kconv.rb	(revision 14101)
@@ -146,7 +146,7 @@
   # convert halfwidth katakana to fullwidth katakana.
   # If you don't want it, use NKF.nkf('-jxm0', str).
   def tojis(str)
-    ::NKF::nkf('-jm', str)
+    ::NKF::nkf('-jm', str).force_encoding("iso-2022-JP")
   end
   module_function :tojis
 
@@ -160,7 +160,7 @@
   # convert halfwidth katakana to fullwidth katakana.
   # If you don't want it, use NKF.nkf('-exm0', str).
   def toeuc(str)
-    ::NKF::nkf('-em', str)
+    ::NKF::nkf('-em', str).force_encoding("EUC-JP")
   end
   module_function :toeuc
 
@@ -174,7 +174,7 @@
   # convert halfwidth katakana to fullwidth katakana.
   # If you don't want it, use NKF.nkf('-sxm0', str).
   def tosjis(str)
-    ::NKF::nkf('-sm', str)
+    ::NKF::nkf('-sm', str).force_encoding("Shift_JIS")
   end
   module_function :tosjis
 
@@ -188,7 +188,7 @@
   # convert halfwidth katakana to fullwidth katakana.
   # If you don't want it, use NKF.nkf('-wxm0', str).
   def toutf8(str)
-    ::NKF::nkf('-wm', str)
+    ::NKF::nkf('-wm', str).force_encoding("UTF-8")
   end
   module_function :toutf8
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]