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

ruby-changes:6796

From: naruse <ko1@a...>
Date: Fri, 1 Aug 2008 23:31:59 +0900 (JST)
Subject: [ruby-changes:6796] Ruby:r18312 (trunk): * transcode.c (transcode_loop): undefined character is replaced with

naruse	2008-08-01 23:29:25 +0900 (Fri, 01 Aug 2008)

  New Revision: 18312

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

  Log:
    * transcode.c (transcode_loop): undefined character is replaced with
      only one character. [ruby-dev:35709]

  Modified files:
    trunk/ChangeLog
    trunk/transcode.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18311)
+++ ChangeLog	(revision 18312)
@@ -1,3 +1,8 @@
+Fri Aug  1 23:26:45 2008  NARUSE, Yui  <naruse@r...>
+
+	* transcode.c (transcode_loop): undefined character is replaced with
+	  only one character. [ruby-dev:35709]
+
 Fri Aug 01 23:26:22 2008  Yuki Sonoda (Yugui)  <yugui@y...>
 
 	Merged r16430(akr), r16431(akr), r16433(akr), r16469(nobu), and
Index: transcode.c
===================================================================
--- transcode.c	(revision 18311)
+++ transcode.c	(revision 18312)
@@ -186,6 +186,7 @@
     unsigned char next_byte;
     int from_utf8 = my_transcoder->from_utf8;
     unsigned char *out_s = out_stop - my_transcoder->max_output + 1;
+    rb_encoding *from_encoding = rb_enc_find(my_transcoder->from_encoding);
     rb_encoding *to_encoding = rb_enc_find(my_transcoder->to_encoding);
 
     while (in_p < in_stop) {
@@ -277,6 +278,10 @@
 	/* valid character in from encoding
 	 * but no related character(s) in to encoding */
 	/* todo: add more alternative behaviors */
+	{
+	    int len = rb_enc_mbclen((const char *)char_start, (const char *)in_stop, from_encoding);
+	    while (in_p < char_start + len) in_p++;
+	}
 	if (opt&UNDEF_IGNORE) {
 	    continue;
 	}

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

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