[Top][All Lists]

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

Re: environment variable don't get coding conversion

From: Ehud Karni
Subject: Re: environment variable don't get coding conversion
Date: Sun, 26 Jan 2003 00:05:42 +0200

Hash: SHA1

On Sat, 25 Jan 2003 14:22:27 -0500, Richard Stallman <address@hidden> wrote:
> "make non-ascii usable" is not specific enough for me to understand.
> I cannot be sure if there is a real problem.

I'd say "Make non-ASCII usable" means that the env var should be usable
in Emacs sub shell. i.e. getenv in program run in subshell will get the
proper value (usually an 8 bit characters for ISO-8859-x).

> Please show me a specific problem case so I can judge if there is a
> significant problem.

We have many variables containing Hebrew strings (ISO-8859-8). They
are accessed by programs and scripts. They are represented by 8 bit
values in process-environment.
e.g. HUSER is set to "דוהא", is stored as "HUSER=\343\345\344\340".

If I do (setenv "HUTST" "דוהא") it is stored as "HUTST=דוהא". Now,
when a subshell is accessing the the HUTST variable it gets
ˆדˆוˆהˆא (i.e. \210 before each Hebrew character).
Here is the output of "env | grep "^HU" | cat -v" run from Emacs:

The way to overcome it in Emacs is to set the env var like this:
  (setenv "HUTST" (encode-coding-string "דוהא" 'hebrew-iso-8bit))

>     If you have a non-ASCII variable name, you can't sensibly use M-x
>     getenv with it;
> getenv could decode the variable name, if that is useful.

You can set non-ASCII variable name, e.g.
  (setenv (encode-coding-string "Hםש" 'hebrew-iso-8bit)
          (encode-coding-string "ינרק" 'hebrew-iso-8bit))
and you can use them in subprocesses. To use them in Emacs itself,
You have to use the encoded Hebrew name, i.e.
  (getenv (encode-coding-string "Hםש" 'hebrew-iso-8bit))

I agree that to use non-ASCII environment variable name is not
practical, so this problem is not really important, but the non-ASCII
values are used a lot, and the practical way for ISO-8859-x is to
have them in unibyte.

The `process-environment' can hold the values in multibyte but
`child_setup' and `getenv_internal' (in callproc.c) should transform
the values to unibyte (or whatever necessary for other coding systems
like CJK and utf-8).


- --
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:address@hidden                  Better  Safe  Than  Sorry
Comment: use http://www.keyserver.net/ to get my key (and others)


reply via email to

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