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

ruby-changes:8531

From: yugui <ko1@a...>
Date: Thu, 30 Oct 2008 23:36:46 +0900 (JST)
Subject: [ruby-changes:8531] Ruby:r20065 (ruby_1_9_1): merges r20057 from trunk into ruby_1_9_1.

yugui	2008-10-30 23:36:18 +0900 (Thu, 30 Oct 2008)

  New Revision: 20065

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20065

  Log:
    merges r20057 from trunk into ruby_1_9_1.
    * pack.c (pack_pack): templates a, A, Z should propagate encoding
      of original strings.  templates b, B, h, H brings ASCII-8BIT to
      the result.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/pack.c

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 20064)
+++ ruby_1_9_1/ChangeLog	(revision 20065)
@@ -10,6 +10,12 @@
 	* enc/trans/iso-8859-1-tbl.rb: new file to avoid having to
 	  treat ISO-8859-1 as special
 
+Thu Oct 30 14:10:46 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* pack.c (pack_pack): templates a, A, Z should propagate encoding
+	  of original strings.  templates b, B, h, H brings ASCII-8BIT to
+	  the result.
+
 Thu Oct 30 09:31:45 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* encoding.c (rb_locale_encoding): makes an alias for locale.
Index: ruby_1_9_1/pack.c
===================================================================
--- ruby_1_9_1/pack.c	(revision 20064)
+++ ruby_1_9_1/pack.c	(revision 20065)
@@ -519,8 +519,15 @@
 		ptr = RSTRING_PTR(from);
 		plen = RSTRING_LEN(from);
 		OBJ_INFECT(res, from);
-		enc = rb_enc_compatible(res, from);
-		rb_enc_associate(res, enc);
+		switch (type) {
+		  case 'a': case 'A': case 'Z':
+		    enc = rb_enc_compatible(res, from);
+		    rb_enc_associate(res, enc);
+		    break;
+		  default:
+		    rb_enc_associate(res, rb_ascii8bit_encoding());
+		    break;
+		}
 	    }
 
 	    if (p[-1] == '*')

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

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