• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: stringWithContentsOfURL bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stringWithContentsOfURL bug?


  • Subject: Re: stringWithContentsOfURL bug?
  • From: Frederick Cheung <email@hidden>
  • Date: Thu, 6 Jan 2005 02:27:47 +0100


On 6 Jan 2005, at 01:19, Benjámin Salánki wrote:

Hi,

I try to access the string using the stringWithContentsOfURL: method (which I have used in quite some projects already, so I already know this should work). When my string is short, maybe 5 lines when displayed in Safari, the string gets loaded fine.
Like this:
<dict><key>Category</key><array><dict><key>category_id</ key><string>1</string><key>category_name</key><string>Finder</ string></dict><dict><key>category_id</key><string>2</ string><key>category_name</key><string>Mail</string></ dict><dict><key>category_id</key><string>3</ string><key>category_name</key><string>Safari</string></dict></ array></dict>


But when I add a longer string, suddenly I get garbled data, with NSLog() only outputting the

ã

character. The strange thing is, that wether I use NSString's, NSData's or whatever else's methods it won't work on any of them. But Safari displays it right, and if i copy it from safari and save the text in TextEdit and name it something.plist it opens up just well in the Property List Editor.

Any ideas what might be causing this or do you have a better way of getting data from a MySQL table on the web to a local plist file?

Is it possible that the webserver is setup to gzip pages above a certain size? The easiest way to check this would probably be to run tcpdump and look at the headers. On my system the request stringWithContentsOfURL makes specifies Accept-Encoding: gzip, so the server is allowed to (and given the rest of the Accept-Encoding header, should if it can) send the page gzipped, but stringWithContentsOfURL doesn't always seem to ungzip it (and I can't see any pattern to when it does and when it doesn't)

Fred

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >stringWithContentsOfURL bug? (From: Benjámin Salánki <email@hidden>)

  • Prev by Date: Re: Ignore accents when comparing strings
  • Next by Date: Re: NSMutableDictionaries as object implementation (was Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???)
  • Previous by thread: stringWithContentsOfURL bug?
  • Next by thread: Re: stringWithContentsOfURL bug?
  • Index(es):
    • Date
    • Thread