I am converting NSData of Image from database to NSString in Iphone
Here is my code
imageData1 = [[NSData alloc] initWithBytes:sqlite3_column_blob(compiledStatement, 3) length: sqlite3_column_bytes(compiledStatement, 3)];
NSString * Str1 = [NSString base64StringFromData: imageData1 length: [imageData1 length]];
NSData *data1=[NSData base64DataFromString:Str1];
NSString* newStr1 = [[NSString alloc] initWithData:data1 encoding:NSUTF8StringEncoding];
the length of data is 6511 , but the newstr1 is nil
With reference to this question: I can't create a UTF-8 encoded string out of just any arbitrary binary data from the database - the data needs to actually be UTF-8 encoded. I have aslo done base 64 encoding and decoding. How can I solve this issue. I need it in the format of NSString only, to give it as input to a csv file?