From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30447 invoked by alias); 3 Nov 2011 21:56:28 -0000 Received: (qmail 30434 invoked by uid 22791); 3 Nov 2011 21:56:26 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from out2.smtp.messagingengine.com (HELO out2.smtp.messagingengine.com) (66.111.4.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Nov 2011 21:56:09 +0000 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 4097421141 for ; Thu, 3 Nov 2011 17:56:08 -0400 (EDT) Received: from frontend1.nyi.mail.srv.osa ([10.202.2.160]) by compute1.internal (MEProxy); Thu, 03 Nov 2011 17:56:08 -0400 Received: from [158.147.67.90] (158-147-67-90.harris.com [158.147.67.90]) by mail.messagingengine.com (Postfix) with ESMTPSA id E6A068E103D; Thu, 3 Nov 2011 17:56:07 -0400 (EDT) Message-ID: <4EB30DF9.2080006@cwilson.fastmail.fm> Date: Thu, 03 Nov 2011 21:56:00 -0000 From: Charles Wilson Reply-To: Charles Wilson User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 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 References: <135801cc9a69$f73ceaf0$e5b6c0d0$@vaultnow.com> In-Reply-To: <135801cc9a69$f73ceaf0$e5b6c0d0$@vaultnow.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/msg00048.txt.bz2 On 11/3/2011 4:48 PM, Leon Vanderploeg wrote: > With cygwin 1.7.5, cFileName with a special characters such as ñ (n > with tidle above it) fail be properly extracted from a > WIN32_FIND_DATA structure with findFirstFile (or findNextFile). > > To set up a simple test scenario, I created a file in C:\Testing > named Mañana.docx. I compiled the code at the end of this message > on Cygwin 1.7.9 with GCC version 3.4.4 on Server 2008 32 bit system. > On this system (and on a Windows 7 32 bit machine), it returns: a) Why are you using native Win32 APIs in a cygwin program? You should be using the POSIX interfaces instead -- see /usr/include/dirent.h. DIR *opendir (const char *); DIR *fdopendir (int); struct dirent *readdir (DIR *); int readdir_r (DIR *, struct dirent *, struct dirent **); void rewinddir (DIR *); int closedir (DIR *); b) What you observe is an artifact of cygwin-1.7's new *support* for i18n. In cygwin-1.5, it just didn't care and passed all the bytes back exactly as found without transliteration. In 1.7, it (correctly) transcodes strings into the current locale -- and your current locale does not appear to support ñ -- or, at least, you haven't told cygwin to use the correct one. (I'm probably thoroughly botching this explanation, but the point is, you need to check your LC_* and LANG env vars, and maybe call setlocale(LC_ALL, "") in your application.) -- Chuck -- 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