public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Charles Wilson <cygwin@cwilson.fastmail.fm>
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
Date: Thu, 03 Nov 2011 21:56:00 -0000	[thread overview]
Message-ID: <4EB30DF9.2080006@cwilson.fastmail.fm> (raw)
In-Reply-To: <135801cc9a69$f73ceaf0$e5b6c0d0$@vaultnow.com>

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

  reply	other threads:[~2011-11-03 21:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03 20:49 Leon Vanderploeg
2011-11-03 21:56 ` Charles Wilson [this message]
2011-11-04  8:47   ` Corinna Vinschen
2011-11-10  5:19     ` Leon Vanderploeg
2011-11-10  9:59       ` Corinna Vinschen
2011-11-10 10:09         ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EB30DF9.2080006@cwilson.fastmail.fm \
    --to=cygwin@cwilson.fastmail.fm \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).