Re: NSURL and percent escaping

R Frith-Macdonald <[email protected]> Fri, 22 Aug 2025 15:48:16 +0100
Newsgroups gmane.comp.lib.gnustep.devel
Message-ID <[email protected]>
This is a bug, pure and simple.=C2=A0 It's supposed to work for the=20
parameters unescaped. I'll look into it.

The workaround is to use initWithString: (with special characters=20
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 =C3=A9crit =
:
>> 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 =3D [[NSURL alloc] initWithScheme:@"http"
>>                                        user:@"p.o.roussel%40free.fr"
>> 								  password:@"password"
>> 								      host:@"127.0.0.1"
>> 									  port:nil
>> 								  fullPath:@"dav.php/calendars/[email protected]/default/"
>> 						   parameterString:nil
>> 						             query:nil
>> 								  fragment:nil];
>> 										=09
>> When I log [url absoluteString] I get the following
>>
>> http://p.o.roussel%2540free.fr:[email protected]/dav.php/calendars/p.o=
[email protected]/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
>> --=20
>> Evolution (n): A hypothetical process whereby infinitely improbable eve=
nts occur with alarming frequency, order arises from chaos, and no one is =
given credit.
>>