Converting NSData to NSString without encoding
I am trying to upload a image onto server's database.
For that I have done
- Converted image to nsdata using UIImageJPEGReprenstation.
- Converted nsdata to nstring using base64lib.
Problem here is that nsstring that I have is NSASCII encoded.
So the default open ssl converters are not able to read the file and convert it into correct images on server side.
So what i need is
The nsstring that I have created from nsdata must not be encoded using nsascii or nsutf8 or something, as the image data is binary.
Or
On server side i must decode the data back to binary f开发者_如何学Pythonrom nsascii or whatever way I have encoded on client side. But here the issue is I do not have any inbuilt api for ascii decoding.
Why do you need to convert the image data to string data? Couldn't you just do an HTTP POST with jpg data (MIME image/jpeg)? This post shows you how to do it.
精彩评论