emacs-devel
[Top][All Lists]
Advanced

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

Re: setenv -> locale-coding-system cannot handle ASCII?!


From: Kenichi Handa
Subject: Re: setenv -> locale-coding-system cannot handle ASCII?!
Date: Wed, 26 Feb 2003 11:34:46 +0900 (JST)
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)

In article <address@hidden>, "Stefan Monnier" <monnier+gnu/address@hidden> 
writes:
>>    (if (multibyte-string-p variable)
>>        (setq variable (encode-coding-string variable locale-coding-system)))
>>  
>>  multibyte-string-p is mandatory because encode-coding-string
>>  will change the byte-sequence of `variable' even if it is
>>  unibyte.
>>  Ex. (encode-coding-string "\201\300" 'iso-latin-1) => "\300"

> I find this behavior annoying because it makes the emacs-mule
> encoding appear in a situation where it is not mentioned.
> I wish that

>     (encode-coding-string "\201\300" 'iso-latin-1)
> and
>     (encode-coding-string (string-to-multibyte "\201\300") 'iso-latin-1)

> returned the same value.

Why?  As I wrote before, what does bytes of unibyte string
means depends on a context.

In the former case, as it is given to encode-coding-string,
it is a multibyte form by which emacs represents
character(s), not a sequence of characters representing raw
bytes.

In the latter case, as it is given to string-to-multibyte,
it should be regard as a sequence of characters representing
raw bytes, thus the result of (string-to-multibyte
"\201\300") is still a sequence of raw-bytes.  Encoding
raw-bytes should yield the same raw-bytes.

And, this behaviour of encode-coding-string on a unibyte
string is a natural consequence of encode-coding-region in a
unibyte buffer.

---
Ken'ichi HANDA
address@hidden




reply via email to

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