Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print NSData as text #123

Closed
ZevEisenberg opened this issue Oct 29, 2015 · 4 comments
Closed

Print NSData as text #123

ZevEisenberg opened this issue Oct 29, 2015 · 4 comments

Comments

@ZevEisenberg
Copy link

I often get NSData representing UTF-8-encoded strings back from APIs. What I want essentially comes down to a shortcut for:

po [[NSString alloc] initWithData:(NSData *)self.mutableData encoding:NSUTF8StringEncoding

But it would need to coexist with the existing feature to print NSData representing an image. It might also be nice to have an option to copy the resulting text to the clipboard, or open it in $EDITOR or maybe even a configurable app (e.g. TextMate or CocoaJSONEditor).

Posting this here to get feedback on what kind of features/options people would want. Would you want other encodings besides UTF-8? How would the interface for that work? If there is interest and some consensus on the interface, I can probably submit a PR.

@mmmulani
Copy link

I would stick to UTF-8, IMO the other encoding don't really matter.

I like the idea of copying to clipboard, opening in editor, etc. but maybe have that as a separate command, so you could chain them like:

pstr dataVariable
$12 = @"..."
copy $12
<$12 is now on the clipboard>
editor $12
<open $EDITOR with $12>

@kastiglione
Copy link
Contributor

Chisel has a pdata command added by @bartoszj in #83.

@ZevEisenberg
Copy link
Author

Cool, that looks like exactly what I was hoping for.

@kastiglione
Copy link
Contributor

Thanks for submitting ideas! Keep em coming 🎇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants