Subject: Re: AW: bug#12807: 24.2; Emacs cannot edit file with funny Unicode characters in the file name on Windows

From: Eli Zaretskii <[email-masked]>
Date: Tue, 06 Nov 2012 05:57:45 +0200

> From: Nils Gösche <[email-masked]>
> Cc: <[email-masked]>
> Date: Mon, 5 Nov 2012 23:05:57 +0100
> 
> > Yes, but the Explorer and the Notepad are about the only programs that
> > do.  Many others don't.  Emacs is one of them.
> 
> »About the only« is a bit of an exaggeration ;-)  Anything that is written
> in C# or Java shouldn't have that problem; or Common Lisp, come to think of
> it. But yeah, back in the old days, pretty much nobody felt like using
> wchar_t instead of char everywhere in C. I didn't, either, back then. (Not
> to mention that in the really old days, wchar_t didn't even exist ;-)

Using wchar_t is not going to solve the whole problem, unfortunately.
The problem is that the mainline Emacs code uses APIs that don't
accept wide characters.  Examples include 'stat', 'access', 'open',
'fopen', etc.  To fix the problem, we'd need to provide our own
implementation of these APIs that would accept a UTF-8 encoded file
name, then re-encode the file name in UTF-16, and call the Unicode
APIs as part of the implementation.  This is a large job.