[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eight-bit char handling in emacs-unicode

From: Kenichi Handa
Subject: Re: eight-bit char handling in emacs-unicode
Date: Thu, 27 Nov 2003 10:34:45 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <jwvhe0rp6ml.fsf-monnier+emacs/address@hidden>, Stefan Monnier 
<address@hidden> writes:
>>>  but since the output is a unibyte string,
>>>  that restrict it to cases where the code-points can be encoded in 8 bits,
>>>  thus it doesn't sound very generic
>>  Yes.  But I thought generic or not is not a point here.

> Except that if it's not generic (in the sense that it does not behave
> meaningfully in all language environments), then it can't be used in generic
> elisp code, right?

Yes.  But, it simply means that insertion of multibyte
string in a unibyte buffer can't be generic.

>>  My examples shows that we can't use encode-coding-string.
>>  How can we use encode-coding-string without knowing what
>>  coding system to use?  I haven't heard your answer yet.

> I can't answer this question without knowing the answer to my question:
> what is string-make-unibyte used for.

It is used for converting a multibyte string to unibyte
before it is inserted in a unibyte buffer.

> I'm not saying that we can do something like:

>   (defun string-make-unibyte (s) (encode-coding-string s <blabla>))

??? I have thought that you are saying that because you
wrote below:

> To do what your string-make-unibyte does you should use
> `encode-coding-string' where the coding system is passed explicitly.


> but I'm saying that everywhere where the current string-make-unibyte is
> used, we should be able to easily replace it by a call to
> encode-coding-string or a code to my make-string-unibyte (which does
> not pay attention to the language environment and only accepts multibyte
> chars that correspond to bytes, i.e. eight-bit-control or
> eight-bit-graphic, or ASCII, and multibyte chars whose internal code point
> is 128-255).

It's an ambiguous statement.  Which are you sauing?

Replace string-make-unibyte by:
(1) encode-coding-string or make-string-unibyte.

(2) a code that applies encode-coding-string or
make-string-unibyte to the whole string depending on
something (perhaps on the input string?).

(3) a code that applies encode-coding-string to substrings
where that is appropriate, and applies make-string-unibyte
to the remaing substrings.

(4) something that I still don't understand.

>>>  I don't see any use of string-make-unibyte in your two examples.
>>  Again, I'd like to ask how to use encode-coding-string
>>  without knowing the proper coding-system in each case.

> How could I know the coding-system to use when replacing
> `string-make-unibyte' if I don't have any actual call to
> string-make-unibyte to work with ?

What a strange logic?!?  You have been argued that we should
replace string-make-unibyte with something that uses
encode-coding-string.  Then you should have an idea about
what coding-system to use for encode-coding-string.

Ken'ichi HANDA

reply via email to

[Prev in Thread] Current Thread [Next in Thread]