This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [1.7] Invalid UTF8 while creating a file -> cannot delete?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]