From: Corinna Vinschen <corinna-cygwin@cygwin.com>
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, 10 Nov 2011 09:59:00 -0000 [thread overview]
Message-ID: <20111110095836.GO15154@calimero.vinschen.de> (raw)
In-Reply-To: <029901cc9f68$41108a80$c3319f80$@vaultnow.com>
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 <sys/cygwin.h>
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);
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
next prev parent reply other threads:[~2011-11-10 9:59 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
2011-11-04 8:47 ` Corinna Vinschen
2011-11-10 5:19 ` Leon Vanderploeg
2011-11-10 9:59 ` Corinna Vinschen [this message]
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=20111110095836.GO15154@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--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).