This is a bug, pure and simple. It's supposed to work for the
parameters unescaped. I'll look into it.
The workaround is to use initWithString: (with special characters
escaped), or to use NSURLComponents.
On 22/08/2025 15:34, Philippe Roussel wrote:
And now with the code...
Le Fri, Aug 22, 2025 at 03:33:52PM +0200, Philippe Roussel a écrit :
Hi all,
I'm trying to instanciate NSURL using -initWithScheme:user:password...
method and I'm having trouble when the user needs escaping. I might be
doing something wrong but I don't understand NSURL behaviour...
Here is a simplified example :
NSURL *url = [[NSURL alloc] initWithScheme:@"http"
user:@"p.o.roussel%40free.fr"
password:@"password"
host:@"127.0.0.1"
port:nil
fullPath:@"dav.php/calendars/p.o.rous...@free.fr/default/"
parameterString:nil
query:nil
fragment:nil];
When I log [url absoluteString] I get the following
http://p.o.roussel%2540free.fr:password@127.0.0.1/dav.php/calendars/p.o.rous...@free.fr/default/
and I don't understand the '%2540' part. If I use the original non
escaped username -initWithScheme return nil;
Full example attached, built and run against libgnustep-base.so.1.28.
Any hint ?
Thanks,
Philippe
--
Evolution (n): A hypothetical process whereby infinitely improbable events
occur with alarming frequency, order arises from chaos, and no one is given
credit.