X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Lapo Luchini Subject: Re: [1.7] Invalid UTF8 while creating a file -> cannot delete? Date: Wed, 16 Sep 2009 00:38:10 +0200 Lines: 41 Message-ID: References: <416096c60909101512l6e42ab72l4ba5fd792363eefd AT mail DOT gmail DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.5.0 In-Reply-To: <416096c60909101512l6e42ab72l4ba5fd792363eefd@mail.gmail.com> OpenPGP: id=C8F252FB; url=http://www.lapo.it/pgpkey.txt X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Andy Koppe wrote: > Hmm, we've lost the \xDF somewhere, and I'd guess it was when the > filename got translated to UTF-16 in fopen(), which would explain what > you're seeing More data: it's not simply "the last character", is something more complex than that. % cat t.c int main() { fopen("a-\xF6\xE4\xFC\xDF", "w"); //ISO-8859-1 fopen("b-\xF6\xE4\xFC\xDFz", "w"); fopen("c-\xF6\xE4\xFC\xDFzz", "w"); fopen("d-\xF6\xE4\xFC\xDFzzz", "w"); fopen("e-\xF6\xE4\xFC\xDF\xF6\xE4\xFC\xDF", "w"); return 0; } % gcc -o t t.c % ./t % find . . ./a-??? ./b-??? ./c-??? ./d-??? ./e-??????? ./t.c ./t.exe It seems that once one "high bit set" byte is encountered, everything past the last of them (itself included) is lost. Also, I can confirm this works too: % rm a-$'\366'$'\344'$'\374'$'\337' but also this, since last one doesn't count: % rm a-$'\366'$'\344'$'\374'$'\336' BTW: I didn't know about that kind of escaping, but zsh auto-completed that for me (excluding the last character, of course) -- Lapo Luchini - http://lapo.it/ -- 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