From: Kenichi Handa <handa@m17n.org>
Cc: emacs-pretest-bug@gnu.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Coding system conversion error
Date: Sat, 12 Feb 2005 10:57:40 +0900 (JST) [thread overview]
Message-ID: <200502120157.KAA24490@etlken.m17n.org> (raw)
In-Reply-To: <420BD292.6040607@swipnet.se> (jan.h.d@swipnet.se)
Sorry for the late response on this thread.
At first, I think xassert in lisp_data_to_selection_data
(xselect.c) is wrong. Here, obj is generated by a Lisp code
that may generate a multibyte string by error (as in the
current case). But, in general, an error in Lisp code
should not lead to abort. So, I propose this change. I
choose string_make_unibyte instead of string_as_unibyte to
avoid exporting Emacs' internal leading bytes.
*** xselect.c 12 Feb 2005 09:54:46 +0900 1.148
--- xselect.c 12 Feb 2005 10:39:47 +0900
***************
*** 1908,1914 ****
}
else if (STRINGP (obj))
{
! xassert (! STRING_MULTIBYTE (obj));
if (NILP (type))
type = QSTRING;
*format_ret = 8;
--- 1908,1915 ----
}
else if (STRINGP (obj))
{
! if (STRING_MULTIBYTE (obj))
! obj = string_make_unibyte (obj);
if (NILP (type))
type = QSTRING;
*format_ret = 8;
In article <420BD292.6040607@swipnet.se>, "Jan D." <jan.h.d@swipnet.se> writes:
> 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
Thank you for finding this bug. As encode-coding-string
should be regarded as an interface between multibyte and
unibyte, it should always return an unibyte string. But,
NOCOPY argument in encode-coding-string and
encode_coding_string is to avoid unnecessary string
allocation if STR is ASCII-only. So, in such a case, I'm
going to change that function to modify STR to unibyte
directly (i.e. by calling STRING_SET_UNIBYTE) instead of
calling Fstring_as_unibyte.
What do you think?
---
Ken'ichi HANDA
handa@m17n.org
next prev parent reply other threads:[~2005-02-12 1:57 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.
2005-02-12 1:57 ` Kenichi Handa [this message]
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=200502120157.KAA24490@etlken.m17n.org \
--to=handa@m17n.org \
--cc=emacs-devel@gnu.org \
--cc=emacs-pretest-bug@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.