all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jan D." <jan.h.d@swipnet.se>
Cc: emacs-pretest-bug@gnu.org, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Coding system conversion error
Date: Thu, 10 Feb 2005 22:30:58 +0100	[thread overview]
Message-ID: <420BD292.6040607@swipnet.se> (raw)
In-Reply-To: <jwvsm44i30n.fsf-monnier+emacs@gnu.org>

Stefan Monnier wrote:

> Well, maybe we can help, if you tell us what you know, ;-)


The mail you replied to was all I knew at the time.  But here is a 
distilled description of the problem (I've omitted the 1025 character 
string):

ELISP> (setq str (string-to-multibyte <1025 ASCII character string>))
...
ELISP> (multibyte-string-p str)
t
ELISP> (multibyte-string-p (encode-coding-string str
                                              
'compound-text-with-extensions))
t     <---- BUG, should be nil
ELISP> (multibyte-string-p (encode-coding-string str 'utf-8))
nil

Most applications don't ask for 'compound-text, so most of the time the 
xassert doesn't abort.


The compound-text case exits in the second return in 
encode_coding_string in coding.c in this code fragment (in the if (from 
== to_byte) cas near the bottom):

  if (! CODING_REQUIRE_ENCODING (coding))
    {
      coding->consumed = SBYTES (str);
      coding->consumed_char = SCHARS (str);
      if (STRING_MULTIBYTE (str))
       {
         str = Fstring_as_unibyte (str);
         nocopy = 1;
       }
      coding->produced = SBYTES (str);
      coding->produced_char = SCHARS (str);
      return (nocopy ? str : Fcopy_sequence (str));
    }

  if (coding->composing != COMPOSITION_DISABLED)
    coding_save_composition (coding, from, to, str);

  /* Try to skip the heading and tailing ASCIIs.  We can't skip them
     if we must run CCL program or there are compositions to
     encode.  */
  if (coding->type != coding_type_ccl
      && (! coding->cmp_data || coding->cmp_data->used == 0))
    {
      SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str),
                                1);
      if (from == to_byte)
       {
         coding_free_composition_data (coding);
         return (nocopy ? str : Fcopy_sequence (str));
       }
      shrinked_bytes = from + (SBYTES (str) - to_byte);
    }

So if str is mulitbyte when it enters this function, the return value is 
multibyte.  I suspect it is here Fstring_as_unibyte should be called, as 
it is in the previous early return.

    Jan D.

  reply	other threads:[~2005-02-10 21:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <v93bwbhsql.fsf@marauder.physik.uni-ulm.de>
     [not found] ` <20050205170221.ZTBD24781.mxfep02.bredband.com@coolsville.localdomain>
     [not found]   ` <v9k6pmhpdt.fsf@marauder.physik.uni-ulm.de>
     [not found]     ` <738f9db09f1986269b8f5719d45d2dd5@swipnet.se>
     [not found]       ` <v9fz08eglp.fsf@marauder.physik.uni-ulm.de>
     [not found]         ` <v9oeewweoh.fsf@marauder.physik.uni-ulm.de>
     [not found]           ` <4207DAF0.6000204@swipnet.se>
2005-02-08 21:50             ` Coding system conversion error (was Re: abort in x_handle_selection_event when copying text) Jan D.
2005-02-08 23:38               ` Coding system conversion error Stefan Monnier
2005-02-10 20:11                 ` Jan D.
2005-02-10 20:17                   ` Stefan Monnier
2005-02-10 21:30                     ` Jan D. [this message]
2005-02-12  1:57                       ` Kenichi Handa
2005-02-12  7:36                         ` Jan D.
2005-02-12 14:34                           ` Kim F. Storm
2005-02-13  0:14                           ` Kenichi Handa
2005-02-13 14:23                             ` Kim F. Storm
2005-02-13 16:10                             ` Stefan Monnier
2005-02-14  1:02                               ` Kenichi Handa
2005-02-14  5:42                                 ` Jan D.
2005-02-14  6:15                                   ` Kenichi Handa
2005-02-12  8:37                   ` Richard Stallman
2005-02-12  2:01                 ` Kenichi Handa
2005-02-10  6:01               ` Coding system conversion error (was Re: abort in x_handle_selection_event when copying text) Richard Stallman

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

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

  git send-email \
    --in-reply-to=420BD292.6040607@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-pretest-bug@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.