991Re: Filename encodings under Win32
- Oct 12, 2003Hmm. My reply appears to have vanished without a trace. I'd attached
os_win32.c (not noticing that it was an extremely oversized source
file--over 100k); I'm resposting with the source file linked. It's
strange that I didn't see any kind of rejection notice.
On Fri, Oct 10, 2003 at 03:16:27PM +0300, Camillo Särs wrote:
> To avoid a lot of codepage mess, I would suggest that the "right way" to
> fix this would be to internally convert all strings passed to the Windows
> api into Unicode. And of course then calling the unicode-versions of the
> functions. The alternative would be to call the ANSI versions, which would
> be plain silly. Firstly, because they only cover the current codepage, and
> secondly because internally NT converts those strings to Unicode anyway.
Most Unicode versions of functions aren't available in 9x, and codepage-
encoded strings must continue to work correctly.
> I'm not sure how much work this would actually be, but until this is
> implemented, Unicode support on Win32 remains partially broken. For many
> users, using us-ascii only in filenames is not a problem, but for those who
> need special characters and want utf-8, this is really a big issue.
You can always use characters that are in your system encoding. Western
(CP1242) users can always use ñ, for example. NT can handle Unicode
filenames, but 9x can't.
Of course, Vim should handle Unicode for filenames (and message boxes,
and so on). Not doing so is hardly up to the quality of Vim's i18n
support. However, there's not enough demand for it, so it just hasn't
been done yet.
I wrote some code to change the filesystem layer to handle Unicode a
while back, including ANSI fallbacks. I didn't bother spending the time
to get it cleaned, tested and applied, because so few other programs
support this (and, as Vim patch turnaround time is understandably latent,
I had more important patches to work on). For example, an Ogg or MP3 with
Japanese in the filename simply can't be loaded by Winamp in Windows, at
all, unless you're in a Japanese codepage.
I found some old copy of this code and attached it. If you want to cvs
diff it, I believe it's from CVS rev 1.60. I don't know what state this
was in, but it should give you an idea of what needs to be done.
I've always wanted the default internal encoding of Vim to be UTF-8 in
Windows. This is one thing that would need to be done to do that, along
with all other Windows API interactions. (I've heard of printing
problems, too, but I don't know about those as I never print.)
Search for "system_has_unicode".
- << Previous post in topic Next post in topic >>