From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.bugs Subject: Re: Process output truncation when using UTF-8 Date: Fri, 30 May 2003 17:16:52 +0900 (JST) Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <200305300816.RAA21216@etlken.m17n.org> References: <874r3f1ocb.fsf@zamazal.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1054282547 2953 80.91.224.249 (30 May 2003 08:15:47 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 30 May 2003 08:15:47 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 30 10:15:45 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Lf3A-0000lF-00 for ; Fri, 30 May 2003 10:15:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Lf4h-00079F-A3 for gnu-bug-gnu-emacs@m.gmane.org; Fri, 30 May 2003 04:17:19 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19Lf4d-00071L-6G for bug-gnu-emacs@gnu.org; Fri, 30 May 2003 04:17:15 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19Lf4W-0006g1-5W for bug-gnu-emacs@gnu.org; Fri, 30 May 2003 04:17:09 -0400 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Lf4R-0006Id-0T for bug-gnu-emacs@gnu.org; Fri, 30 May 2003 04:17:03 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2])h4U8Gru09741; Fri, 30 May 2003 17:16:53 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) h4U8Gr914716; Fri, 30 May 2003 17:16:53 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id RAA21216; Fri, 30 May 2003 17:16:52 +0900 (JST) Original-To: pdm@zamazal.org In-reply-to: <874r3f1ocb.fsf@zamazal.org> (message from Milan Zamazal on Wed, 28 May 2003 10:12:52 +0200) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5198 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5198 In article <874r3f1ocb.fsf@zamazal.org>, Milan Zamazal writes: > When I start a process, set its input and output encoding > to utf-8 and send a long string to it through > process-send-string, usually some final part of the sent > string is missing on the recipient's side. Thank you for the report. I've just installed the attached change in RC and HEAD. It should be applicable also to Emacs 21.3. --- Ken'ichi HANDA handa@m17n.org 2003-05-30 Kenichi Handa * coding.c (ccl_coding_driver): Set ccl->eight_bit_control properly before calling ccl_driver. * ccl.h (struct ccl_program) eight_bit_control. (setup_ccl_program): Initialize ccl->eight_bit_control to zero. Index: coding.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/coding.c,v retrieving revision 1.222.4.16 retrieving revision 1.222.4.17 diff -u -c -r1.222.4.16 -r1.222.4.17 cvs server: conflicting specifications of output style *** coding.c 7 Mar 2003 04:37:21 -0000 1.222.4.16 --- coding.c 30 May 2003 08:12:19 -0000 1.222.4.17 *************** *** 4477,4483 **** --- 4477,4486 ---- if (ccl->eol_type ==CODING_EOL_UNDECIDED) ccl->eol_type = CODING_EOL_LF; ccl->cr_consumed = coding->spec.ccl.cr_carryover; + ccl->eight_bit_control = coding->dst_multibyte; } + else + ccl->eight_bit_control = 1; ccl->multibyte = coding->src_multibyte; if (coding->spec.ccl.eight_bit_carryover[0] != 0) { Index: ccl.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/ccl.h,v retrieving revision 1.16 retrieving revision 1.16.12.1 diff -u -c -r1.16 -r1.16.12.1 cvs server: conflicting specifications of output style *** ccl.h 27 Feb 2001 03:29:08 -0000 1.16 --- ccl.h 30 May 2003 08:12:38 -0000 1.16.12.1 *************** *** 65,72 **** system. */ int suppress_error; /* If nonzero, don't insert error message in the output. */ ! int eight_bit_control; /* Set to nonzero if CCL_WRITE_CHAR ! writes eight-bit-control char. */ }; /* This data type is used for the spec field of the structure --- 65,75 ---- system. */ int suppress_error; /* If nonzero, don't insert error message in the output. */ ! int eight_bit_control; /* If nonzero, ccl_driver counts all ! eight-bit-control bytes written by ! CCL_WRITE_CHAR. After execution, ! if no such byte is written, set ! this value to zero. */ }; /* This data type is used for the spec field of the structure Index: ccl.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/ccl.c,v retrieving revision 1.71 retrieving revision 1.71.12.1 diff -u -c -r1.71 -r1.71.12.1 cvs server: conflicting specifications of output style *** ccl.c 17 May 2001 09:09:14 -0000 1.71 --- ccl.c 30 May 2003 08:13:01 -0000 1.71.12.1 *************** *** 717,723 **** if (bytes == 1) \ { \ *dst++ = (ch); \ ! if ((ch) >= 0x80 && (ch) < 0xA0) \ /* We may have to convert this eight-bit char to \ multibyte form later. */ \ extra_bytes++; \ --- 717,723 ---- if (bytes == 1) \ { \ *dst++ = (ch); \ ! if (extra_bytes && (ch) >= 0x80 && (ch) < 0xA0) \ /* We may have to convert this eight-bit char to \ multibyte form later. */ \ extra_bytes++; \ *************** *** 731,736 **** --- 731,737 ---- CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ } while (0) + /* Encode one character CH to multibyte form and write to the current output buffer. The output bytes always forms a valid multibyte sequence. */ *************** *** 874,880 **** each of them will be converted to multibyte form of 2-byte sequence. For that conversion, we remember how many more bytes we must keep in DESTINATION in this variable. */ ! int extra_bytes = 0; if (ic >= ccl->eof_ic) ic = CCL_HEADER_MAIN; --- 875,881 ---- each of them will be converted to multibyte form of 2-byte sequence. For that conversion, we remember how many more bytes we must keep in DESTINATION in this variable. */ ! int extra_bytes = ccl->eight_bit_control; if (ic >= ccl->eof_ic) ic = CCL_HEADER_MAIN; *************** *** 1849,1855 **** ccl->ic = ic; ccl->stack_idx = stack_idx; ccl->prog = ccl_prog; ! ccl->eight_bit_control = (extra_bytes > 0); if (consumed) *consumed = src - source; return (dst ? dst - destination : 0); --- 1850,1856 ---- ccl->ic = ic; ccl->stack_idx = stack_idx; ccl->prog = ccl_prog; ! ccl->eight_bit_control = (extra_bytes > 1); if (consumed) *consumed = src - source; return (dst ? dst - destination : 0); *************** *** 2004,2009 **** --- 2005,2011 ---- ccl->stack_idx = 0; ccl->eol_type = CODING_EOL_LF; ccl->suppress_error = 0; + ccl->eight_bit_control = 0; return 0; }