[vlc-devel] [PATCH] gui: Replace all spaces with "%20" in URLs

Rob Jonson rob at hobbyistsoftware.com
Thu Dec 22 12:19:30 CET 2011


stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding doesn't
quite do the job on mac.

I use this category on NSString:

-(NSString*)fullyEscapedStringForUrl
{
	NSString *newString= (NSString*)CFURLCreateStringByAddingPercentEscapes(
																  NULL,
																  (CFStringRef)self,
																  NULL,
																  (CFStringRef)@";/?:@&=+$,",
																  kCFStringEncodingUTF8
																  );

	[newString autorelease];
	return newString;
}


This is assuming you do want to encode chars like & and ? as part of a
param, rather than a param indicator.

cheers,

Rob



On 22 December 2011 08:13, Faustino Osuna <enrique.osuna at gmail.com> wrote:
> So does the Mac.
>
> http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html
>
> Something like this maybe:
>  [o_mrl_string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
>
> Enrique
>
> On Thu, Dec 22, 2011 at 2:38 AM, mirsal <mirsal at mirsal.fr> wrote:
>>
>> Hello,
>>
>> On Wed, 2011-12-21 at 19:48 +0200, Rémi Denis-Courmont wrote:
>> > Le mercredi 21 décembre 2011 19:26:58 Jan Scheers, vous avez écrit :
>> > > fix #3435
>> >
>> > If I see where this is going, you should probably replace all URL-unsafe
>> > characters, not just white spaces.
>> >
>> > It might make sense to write a helper function.
>>
>> Actually, Qt already has one:
>>
>>
>> http://developer.qt.nokia.com/doc/qt-4.8/qurl.html#id-ca5d3c1c-5962-46a8-b1ba-0883ed782a47
>>
>> Best regards,
>>
>> --
>> mirsal
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> http://mailman.videolan.org/listinfo/vlc-devel
>>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>



-- 





Hobbyist Software is a trading name of Hobbyist Software Limited.
Registered office Flat 4 Eastmead Court, Bristol BS9 1HP. Registered
in England. Company no:7876492



More information about the vlc-devel mailing list