Re: renaming a file with special/reserved characters in name
Re: renaming a file with special/reserved characters in name
- Subject: Re: renaming a file with special/reserved characters in name
- From: Michael Ash <email@hidden>
- Date: Thu, 26 Feb 2009 13:00:02 -0500
On Thu, Feb 26, 2009 at 12:52 PM, Mike Abdullah
<email@hidden> wrote:
> This sounds a very interesting thing to watch out for. Do you know how
> NSString's -fileSystemRepresentation method handles NUL characters? I'm
> thinking ideally it should strip them for you.
Ideally it should. Practically it doesn't. Instead it truncates it for
you. (More likely, it doesn't handle NUL at all and gives you the
entire string, but since it's a C string, it stops at the first NUL
and the remainder goes unused..)
> Is there a good way to
> reproduce this from the GUI, or is it best to test with hardcoded strings
> fed into the system like your example?
I couldn't think of a pure GUI example, but this bit of Terminality
will get you a nice test string you can paste into anything:
python -c 'import sys;sys.stdout.write("foo\x00bar")' | pbcopy
I tested it with Safari by saving my gmail page and pasting the result
into the save panel. "foobar" read the save panel, "foo" read the
resulting file. So it works fine to test.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden