unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
Cc: emacs-devel@gnu.org
Subject: Re: copying to clipboard silently discards lines
Date: Fri, 25 Feb 2005 18:24:46 +0100	[thread overview]
Message-ID: <m3r7j4wo0x.fsf@seneca.benny.turtle-trading.net> (raw)
In-Reply-To: <1156.220.255.172.231.1109344154.squirrel@www.stupidchicken.com> (Chong Yidong's message of "Fri, 25 Feb 2005 10:09:14 -0500 (EST)")

Hi Chong Yidong,


"Chong Yidong" writes:
> The bug is in the Lisp_Object QUNICODE, which specifies the
> "utf-16le-dos" coding system used by `selection-coding-system'.

QUINCODE is just a symbol, a unique string.  It is used for looking up
the actual coding-system.  setup_coding_system() in src/coding.c does
that lookup by filling in the struct coding_system.

> When a coding_system is extracted from QUNICODE, the parameter
> coding->spec.ccl.encoder.buf_magnification is 1. This causes a call to
> encoding_buffer_size (in convert_to_handle_as_coded, w32select.c:247) to
> return a buffer size that is too small for the encoded string.
>
> I'm guessing the magnification has to be set to 2, because `abc...'
> gets encoded to `a\0b\0c\0...' (encoding_buffer_size multiplies this
> again by 2, because of the CRLF issue.)

That would indicate that the coding-system "utf-16le-dos" itself has a
bug.  The source code description comment for encoding_buffer_size()
says

 Return maximum size (bytes) of a buffer enough for encoding SRC_BYTES
 of text to CODING.

which matches its usage in w32select.c, I think.

> Trouble is, I can't find where the `spec.ccl...', or indeed any of
> the other parameters of QUNICODE are initialized.

Grep is our friend ;-).  The coding-system (and its CCL programs) is
created in lisp/international/ccl.el using (define-ccl-program ...).
The parameter BUFFER_MAGNIFICATION for that function is set as 1 there
for the encoders (ccl-encode-mule-utf-16le, ccl-encode-mule-utf-16be,
ccl-encode-mule-utf-16le-with-signature,
ccl-encode-mule-utf-16be-with-signature), so that might well be the
problem.

Can you try and replace that 1 with 2 and see if your problem goes
away?


benny

  reply	other threads:[~2005-02-25 17:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2150.220.255.172.231.1109220271.squirrel@220.255.172.231>
     [not found] ` <1515.220.255.172.231.1109259901.squirrel@220.255.172.231>
2005-02-25 15:09   ` copying to clipboard silently discards lines Chong Yidong
2005-02-25 17:24     ` Benjamin Riefenstahl [this message]
2005-02-26  2:53       ` Chong Yidong
2005-02-28  7:20         ` Kenichi Handa
2005-02-28 19:13           ` Benjamin Riefenstahl
2005-03-08  9:10             ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3r7j4wo0x.fsf@seneca.benny.turtle-trading.net \
    --to=b.riefenstahl@turtle-trading.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).