help-emacs-windows
[Top][All Lists]
Advanced

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

Re: [h-e-w] Accents in environment variables - HOME


From: Benjamin Riefenstahl
Subject: Re: [h-e-w] Accents in environment variables - HOME
Date: Sat, 10 Apr 2004 21:04:46 +0200
User-agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3.50 (gnu/linux)

Hi Jason,


Jason Rumney <address@hidden> writes:
> Good spotting! Could cp850 be equally likely? I think a French
> locale is more likely to be cp850 than cp437.

Yes, of course, I forgot that.  For testing the two are mostly the
same, but 850 is of course actually used these days.  And than it's
specially designed to support French better.

> The default I would expect is 1252 (the Windows Western European
> codepage).

That's the GUI encoding (so-called "ANSI").  But Windows (western
versions) still uses 850 (so-called "OEM") for command-lines and
probably (as we just discovered) environment variables.

Note that internally NT/W2K/XP converts this info to Unicode as an
intermediate step.  So unless we want to get roundtrip errors, we
should play by the rules.  If we can make out the rules
:-(.

> Do other European users need to set locale-coding-system to cp850 or
> cp437 to get what they expect?

My environment doesn't have any non-ASCII characters so I haven't
noticed this before.

> If so the default needs changing.

As this is different between with and without runemacs, there is
obviously some other problem first.

I did some testing.  The problem seems to be the call to
GetEnvironmentStrings() in runemacs.c.  For some reason,
GetEnvironmentStrings() returns an "OEM" encoded memory block, while
CreateProcess() expects the block to be "ANSI" encoded.  As passing
GetEnvironmentStrings() directly is equivalent to passing NULL here
anyway, leaving the call out altogether works and is probably the best
(see attached one-line patch).

With this change, locale-coding-system == windows-1252 should be the
right choice.  Actually this should be set from a call to the GetACP()
API directly or indirectly (I haven't checked the source, so this may
already be so in CVS).

Other results of my testing: GetModuleFilename(),
GetEnvironmentVariable() and SetEnvironmentVariable() use the "ANSI"
encoding as expected and documented.


> [locale-coding-system]

It's not clear to me what is covered by locale-coding-system besides
environment variables?  Documentation for the variable says "system
messages", what does that mean?  And why doesn't it mention
environment variables there?  The connection is only made in the docs
for process-environment, even (getenv) docs don't mention it.  OTOH,
like Michelle, I also would have expected that (getenv) and (setenv)
do the necessary conversions automatically.


benny


2004-04-10  Benjamin Riefenstahl  <address@hidden>

        * nt/runemacs.c (WinMain): Don't call GetEnvironmentStrings(), it
        creates encoding problems. 

Attachment: env.patch
Description: Text Data


reply via email to

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