On Thu, Feb 26, 2009 at 12:52 PM, Mike Abdullah
<cocoa...@mikeabdullah.net> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to