Subject: Re: Accessing filenames with different charsets
From: "Chris January" <[email-masked]>
To: "Ville Herva" <[email-masked]>
Cc: <[email-masked]>
Date: Wed, 3 Jul 2002 11:30:19 +0100

> > I wrote a patch for Cygwin yesterday that converts Unicode filenames to
UTF8
> > and back for some file operations.
>
> Nice!
>
> > This should do what you want and allow you to restore the names
correctly
> > later. I will post it to cygwin-patches sometime today, but I'm not sure
> > whether the patch will appear in a Cygwin snapshot anytime soon, if not
I
> > can send you the modified binary and the patch directly for you to try.
> > The only disadvantage with this method is it still makes the filenames
> > impossible to type. However, if you have your terminal set up correctly,
> > it is certainly possible to read them as they should be (e.g. in xterm
> > with UTF8 support turned on). If you are using a graphical file browser
> > like konqueror then that makes things even easier.
>
> Yes, UTF8 approach is propably preferable in all ways. As for typing, I
> imagine you can get the 8.3 name with
>
>   for i in *; do echo $i: `cygpath -w -s $i`; done
>
> so you'll be able to type some name for the file as well.
>
> I'm really glad to see this fixed.
>
> What about filenames longer than MAX_PATH? Those can only be accessed with
> "\\.\<path>" and unicode file functions...
Since most programs internally allocate a buffer of size MAX_PATH or
PATH_MAX, they won't have enough room to store the full filename. Tt would
certainly be possible to support this if a system call was made with a long
filename, but that would mean replacing all statically allocated path
buffers (e.g. char buf[MAX_PATH]) with alloca (e.g. char *buf = alloca
(strlen(inbuf) + margin)) which is more than trivial.

Chris

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/