This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Accessing filenames with different charsets

On Tue, Jul 02, 2002 at 10:50:31PM +0100, you [Chris January] wrote:
> Qt (from Trolltech) encodes Unicode filenames before they are used. In
> Cygwin we could do the reverse, i.e. use Find*FileW and then encode the
> Unicode as a local ANSI string. If we do the encoding manually in Cygwin,
> rather than let Windows do it for us, this would overcome the problem. I
> will try to put together a patch for this that you can test. One possibility
> is to encode Unicode strings as UTF-8.

Another idea that comes into mind: use the cAlternateFileName field from
WIN32_FIND_DATA - that is, the 8.3 filename. I tried it, and I can access
the file via it's 8.3 name in cygwin:

  wc F305~1.TES
    318    1214   10141 F305~1.TES

So all that'd have to be done is make cygwin readdir (and friends) return
the 8.3 name if the normal name is inaccessible (different charset, too long
name... I'm not yet sure how to detect this).

The advantage over encoding the wide char name somehow is that the 8.3 name
is usable in DOS/windows as well. The disadvantage is that a name like
F305~1 doesn't really tell anything about the real filename. And, if you
back it up (say, with tar), and then restore it, you lose the original name.
While not perfect that's still better than losing the whole file.

-- v --

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]