From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6099 invoked by alias); 10 Nov 2011 10:09:09 -0000 Received: (qmail 6070 invoked by uid 22791); 10 Nov 2011 10:08:48 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Thu, 10 Nov 2011 10:08:35 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 4359C2C0486; Thu, 10 Nov 2011 11:08:27 +0100 (CET) Date: Thu, 10 Nov 2011 10:09:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Possible Bug (clarification) in Cygwin 1.7.5 -- findfirstfile (and findnextfile) yeild bad cfilename when file names have special characters. Works in cygwin 1.5, fails in 1.7 Message-ID: <20111110100827.GQ15154@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <135801cc9a69$f73ceaf0$e5b6c0d0$@vaultnow.com> <4EB30DF9.2080006@cwilson.fastmail.fm> <20111104084619.GM9159@calimero.vinschen.de> <029901cc9f68$41108a80$c3319f80$@vaultnow.com> <20111110095836.GO15154@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20111110095836.GO15154@calimero.vinschen.de> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-11/txt/msg00180.txt.bz2 On Nov 10 10:58, Corinna Vinschen wrote: > On Nov 9 22:18, Leon Vanderploeg wrote: > > Many thanks to Charles and Corinna for the help. I have modified the > > code to use the POSIX functions. I still have one problem I cannot > > seem to conquer. > > > > I need to be able to read and write the (yes, I know it's evil) > > archive bit. Unless there is a POSIX function (which I seriously > > doubt) for these items, I am locked into the windows APIs. > > > > I have read and re-read the Cygwin documentation on > > internationalization at least 6 times and I cannot figure out what I > > need to do to get this to work. I have tried numerous combinations of > > environment variables and locale settings in the code, but none of > > them work. The windows API fails to find the file specified. I just > > want US English that can handle the extended character set to the > > windows APIs. In this case, let's use the example of the copyright > > symbol (the small c with a circle around it). What needs to be set in > > the environment, and what needs to be set in the C code to handle > > these characters correctly? > > Nothing. Just use always the UNICODE API, rather than the ANSI API: > > #include > > DWORD > my_GetFileAttributes (const char *cygwin_multibyte_filename) > { > DWORD attr = INVALID_FILE_ATTRIBUTES; > PWCHAR w32_filename = cygwin_create_path (CCP_POSIX_TO_WIN_W, > cygwin_multibyte_filename); > if (w32_filename) > { > attr = GetFileAttributes (w32_filename); Sigh. Please make that attr = GetFileAttributesW (w32_filename); Note the trailing W. > free (w32_filename); > } > return attr; > } Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple