[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

no subject

From: Sebastian Reitenbach
Subject: no subject
Date: Mon, 14 Apr 2008 11:41:31 +0200


I tried to download a csv file from a webserver.I found an example using 
As the documentation says, NSURL needs an
escaped string, so I used 
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding, so I wrote 
the test below:
=================Sample Program================================
#include <Foundation/Foundation.h>

main(int argc, const char *argv[])
  id pool = [[NSAutoreleasePool alloc] init];

  NSString *GKey = 

  NSString *Address = @"Potsdamer+Platz+Berlin+Germany";
  NSString *URLString = [NSString 
Address, GKey];
  URLString = [URLString 
  NSLog(@"URL: %@", URLString);
  NSURL *url = [NSURL URLWithString:URLString];
  NSLog(@"NSURL *url: %@", url);
  NSString *coordinates = [NSString stringWithContentsOfURL:url];
  NSArray *coordItems = [coordinates componentsSeparatedByString:@","];
  NSLog(@"Latitude: %@ Longitude: %@", [coordItems objectAtIndex:2], 
[coordItems objectAtIndex:3]);
  NSString *GeoCacheURL = [NSString 

[coordItems objectAtIndex:2], [coordItems objectAtIndex:3]];
  NSLog(@"NewURL: %@", GeoCacheURL);
  [pool release];

  return 0;
=================Sample Program================================

Why I now ask is, on the address@hidden mailing list, 
I got told that 
might not be implemented correctly. 

=================Snippet from other M/L============================
On 14.04.2008, at 07:15, Sebastian Reitenbach wrote:
>> This would be a major bug in GNUstep, which is quite unlikely. As
>> mentioned the whole approach is utterly wrong. It is more likely that
>> stringByAddingPercentEscapesUsingEncoding only encodes a subset and  
>> is
>> not a proper URL fragment encoder.
> The gnustep documentation to the method implementation starts this  
> way:
> /**
> * Constructs a new ASCII string which is a representation of the  
> receiver
> * in which characters are escaped where necessary in order to  
> produce a
> * legal URL.<br />

If you pipe a whole URL through it and it still can be parsed as a  
URL, its obviously wrong. The whole point of escaping is that the  
result is NOT parsed.
=================Snippet from other M/L============================

As I have no possibility to veryfy who is right, on a MAC, I thought I just 
you know, and maybe someone can tell me, who is right.

thank you.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]