1

problem with string capacity when parsing url if the capacity more than 35000bytes NSString showing null value. can anyone help me how to resolve this issue.is there any way to increase string capacity?

NSURL *url = [[NSURL alloc] initWithString:entrytab.articleUrl];
          NSLog(@"ENtry url:%@",url);
NSData *data = [[NSData alloc] initWithContentsOfURL:url]; 
NSString *html = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 
NSLog(@"ENtry html%@",html);
Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
AVINASH KANNA
  • 617
  • 1
  • 5
  • 11
  • That size is OK. if still you need more use mmap. – Anoop Vaidya Jan 29 '13 at 10:49
  • Actually i am storing that string data into database so,i have to reuse it.is there any other way to increase string capacity? – AVINASH KANNA Jan 29 '13 at 10:53
  • You need to store it anywhere, only after that you can convert it into string, arrays of string, data, files etc. I am not sure about your problem see here for nsstring limits : http://stackoverflow.com/questions/6482641/what-is-the-maximum-length-of-an-nsstring-object – Anoop Vaidya Jan 29 '13 at 11:04
  • Well, wait. What's more than 35,000 bytes? The URL you're parsing in the first line, or the data you're retrieving in the second line? – Peter Hosey Jan 29 '13 at 17:26
  • got the solution and thanks for giving reply..actually i am using NSUTF8StringEncoding and for some urls it is not accepting..i thought of string capacity but am wrong....and its not about string capacity..its about encoding URL.string can store much more data..i am wrong in my post .now i changed to NSASCIIStringEncoding.it is working fine now. – AVINASH KANNA Jan 30 '13 at 07:42
  • @AVINASHKANNA: ASCII and UTF-8 are not the same thing. If your input is UTF-8, using ASCII is wrong. If it isn't, then it isn't really ASCII, either, but Cocoa is more lenient than it should be about letting you interpret non-ASCII data as “ASCII” (it actually treats it as ISO 8859-1). You should determine what encoding your input is in and use that encoding. – Peter Hosey Jan 31 '13 at 02:43
  • Also, if your data does not represent text, then there is *no* correct encoding and you should not use NSString. Data that is not text should be handled as NSData, never NSString. – Peter Hosey Jan 31 '13 at 02:44

0 Answers0