How to find why NSMutableData is invalid?

First I would use initWithData:encoding: to setup the NSString. Small difference, but that method is there for a reason Then, I would do a hexdump of self. ReceivedData to see what is actually in there.

If that data is not properly UTF8 encoded then the initWithData:encoding: will fail (Google for NSData hex dump to find other people's utility functions to do this) I have found that sometimes web services are sloppy with their encoding. So I usually implement a fallback like this: NSString* html = NSString alloc initWithData: data encoding: NSUTF8StringEncoding; if (html == nil) { html = NSString alloc initWithData: data encoding: NSISOLatin1StringEncoding; if (html == nil) { html = NSString alloc initWithData: data encoding: NSMacOSRomanStringEncoding; } } It is kind of sad that this is required but many web services are not written or configured properly.

First I would use initWithData:encoding: to setup the NSString. Small difference, but that method is there for a reason. Then, I would do a hexdump of self.

ReceivedData to see what is actually in there. If that data is not properly UTF8 encoded then the initWithData:encoding: will fail. (Google for NSData hex dump to find other people's utility functions to do this) I have found that sometimes web services are sloppy with their encoding.So I usually implement a fallback like this: NSString* html = NSString alloc initWithData: data encoding: NSUTF8StringEncoding; if (html == nil) { html = NSString alloc initWithData: data encoding: NSISOLatin1StringEncoding; if (html == nil) { html = NSString alloc initWithData: data encoding: NSMacOSRomanStringEncoding; } } It is kind of sad that this is required but many web services are not written or configured properly.

Thanks. Your technique is definitely giving back some better info. – 4thSpace Mar 15 '10 at 1:03.

1 And if the bytes represent data as a string, you can cut and paste them into 0xED to make viewing super easy: suavetech. Com/0xed/0xed. Html – nall Mar 15 '10 at 1:35.

Iphone - How to find why NSMutableData is invalid - Stack Overflow.

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.

Related Questions