[Top][All Lists]
[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 09:58:23 +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>, Miles Bader <address@hidden> writes:
> Kenichi Handa <address@hidden> writes:
>> > [I'm confused about what `multibyte-string-p' actually _means_, by the
>> > way -- shouldn't it only ever return t if the string contains non-ascii
>> > characters?]
>>
>> Looong ago I proposed the same thing to Richard. His answer
>> was that the multibyteness of a string should follow the
>> source of the string.
> That would seem to make it almost useless for a lisp programmer...
> What is the purpose of using it in a function like `setenv'?
> Is it just an efficiency hack? If so, why not just move the test into
> find-coding-systems-string [or whatever function actually does the work
> for it] so that ordinary programms don't have to worry about such
> sillyness?
For this part:
(if (and (multibyte-string-p variable) locale-coding-system)
(let ((codings (find-coding-systems-string (concat variable value))))
(unless (or (eq 'undecided (car codings))
(memq (coding-system-base locale-coding-system) codings))
(error "Can't encode `%s=%s' with `locale-coding-system'"
variable (or value "")))))
yes, multibyte-string-p is just for efficiency. We can make
it simply to:
(let ((codings (find-coding-systems-string (concat variable value))))
(unless (or (eq 'undecided (car codings))
(memq (coding-system-base locale-coding-system) codings))
(error "Can't encode `%s=%s' with `locale-coding-system'"
variable (or value ""))))
But, in this part,
(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"
By the way, I still think it's better to have multibyte
strings in process-environment in a multibyte session. But,
it seems that Richard is not convinced. So, we need
something like this Dave's change.
---
Ken'ichi HANDA
address@hidden
- setenv -> locale-coding-system cannot handle ASCII?!, Sam Steingold, 2003/02/24
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Kenichi Handa, 2003/02/25
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Miles Bader, 2003/02/25
- Re: setenv -> locale-coding-system cannot handle ASCII?!,
Kenichi Handa <=
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Stefan Monnier, 2003/02/25
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Kenichi Handa, 2003/02/25
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Stefan Monnier, 2003/02/25
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Kenichi Handa, 2003/02/26
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Stefan Monnier, 2003/02/26
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Kenichi Handa, 2003/02/26
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Kenichi Handa, 2003/02/26
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Stefan Monnier, 2003/02/26
- Re: setenv -> locale-coding-system cannot handle ASCII?!, Stefan Monnier, 2003/02/26
- tar-mode, Kenichi Handa, 2003/02/26