www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/03/05:40:27

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 3 Jul 2002 12:38:37 +0300
From: Ville Herva <vherva AT niksula DOT hut DOT fi>
To: cygwin AT cygwin DOT com
Subject: Re: Accessing filenames with different charsets
Message-ID: <20020703093837.GI9092@niksula.cs.hut.fi>
References: <20020701085851 DOT GD9092 AT niksula DOT cs DOT hut DOT fi> <20020702213825 DOT GF9092 AT niksula DOT cs DOT hut DOT fi> <01f801c22212$7d0cecf0$0100a8c0 AT advent02>
Mime-Version: 1.0
In-Reply-To: <01f801c22212$7d0cecf0$0100a8c0@advent02>
User-Agent: Mutt/1.3.25i

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 --

v AT iki DOT fi

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019