Supposing you got a NSURLResponse* response and an NSData* data: CFStringEncoding cfEncoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef) response textEncodingName); NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(cfEncoding); NSString* string = NSString alloc initWithData:data encoding:encoding; // Do stuff here.. string release.
First of all here is my code -(NSString *)UTF8StringFromData:(NSData *)theData{ Byte *arr = theData bytes; NSUInteger begin1 = self findIndexOf:@"" bArr:arr size:theData length+4; NSUInteger end1 = self findIndexOf:@"" bArr:arr size:theData length; Byte *arr1 = (Byte *)malloc(sizeof(Byte)*((end1-begin1+1))); int j = 0; for (int I = begin1; I.
... come on... Someone must have come across this before – Alex1987 Sep 11 '09 at 17:01.
I'm getting an html file as NSData and need to parse it to extract some info. My approach was to convert it to NSString with UTF8 encoding (the html has non english characters, russian for example) - it failed. But it returned nil.
But when it encounters russian characters for example it returns jibrish. Then my next approach was to parse the byte array of the data, extract the bytes I need and somehow convert them to NSString.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.