Re: escaping a string

2008-09-21 Thread Sandro Noel
Oups, I did not think of that ... newbe error :) Thanks. On 21-Sep-08, at 4:25 PM, Andrew Farmer wrote: On 21 Sep 08, at 11:14, Sandro Noel wrote: so basically what i'm dooing here, is that if i find the caracter "d" and i'm at least 4 bytes into the file, i check to see if the 4 caracters

Re: escaping a string

2008-09-21 Thread Andrew Farmer
On 21 Sep 08, at 11:14, Sandro Noel wrote: so basically what i'm dooing here, is that if i find the caracter "d" and i'm at least 4 bytes into the file, i check to see if the 4 caracters before my location contain the word "info", so then i know that my current location is the start of the in

Re: escaping a string

2008-09-21 Thread Sandro Noel
Stephen. I'm really new at a lot of things at this point in time...(torrents, cocoa, binary format, ) in this litle adventure of mine, so please excuse if the questions seem a little beginner's type. Would this function make more sense? is this the "right way to do it" ? so basically what

Re: escaping a string

2008-09-21 Thread Stephen J. Butler
On Sun, Sep 21, 2008 at 12:09 AM, Sandro Noel <[EMAIL PROTECTED]> wrote: > NSData *torrentData = [[NSData alloc]initWithContentsOfURL:[NSURL > URLWithString:itemLink]]; > if (0 < [torrentData length]){ >NSString *torrentString = [[[NSString alloc]initWithData:torrentData > encoding:NSASCIIS

Re: escaping a string

2008-09-20 Thread Sandro Noel
Mike, thank you for the explanation, I am using NSData to unbencode the torrent file. ans sucessfully store it to a NSDictionary, "plist" so i can read it outside the software. that works just fine... The sha1 hash data is embedded raw, right in the file. No escaping is done, because there is

Re: escaping a string

2008-09-20 Thread Michael Ash
On Sat, Sep 20, 2008 at 10:53 PM, Sandro Noel <[EMAIL PROTECTED]> wrote: > Greetings. > > i'm playing around with the torrent specification. and i'm trying to talk to > a tracker. > for that i need to generate an info_hash > acording to the protocol definition the string needs to be escaped. > > Th

escaping a string

2008-09-20 Thread Sandro Noel
metainfo file. Note that this is a substring of the metainfo file. This value will almost certainly have to be escaped. my question here, if anyone has done that in the past, in cocoa, how was it done. and if you have any pointers on "escaping" a string in cocoa, any informat