• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
escaping a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

escaping a string


  • Subject: escaping a string
  • From: Sandro Noel <email@hidden>
  • Date: Sat, 20 Sep 2008 22:53:43 -0400

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.


The 20 byte sha1 hash of the bencoded form of the info value from the 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 information would be usefull..


i've tried
torrentString = [torrentString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
and
torrentString = [torrentString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];


they both produce a null string, so obviously this is not it...
if it can help this is the string I have to escape.

start here--------------------------------------------------
6:lengthi367464134e4:name48:Stargate.Atlantis.S05E09.HDTV.XviD-0TV. [VTV].avi12:piece lengthi1048576e6:pieces7020:‹Olz;hBfï/k Òîvd˙Ù̉0>j’+‡;|8_Wg
Ü:∏ˇHPR‰¯÷ó·êÎ∆BABÄ"<Ñgÿ| %Fˇ,Âw8th˜U*ÏâUR(‰¤F1>ÑìΩ‘•
o…ˆsÆ
eƒÎûÍCH ˙¥¸û∆Â, œ6Pn˙¡‡¯| ÑNù∆àoÏˇqÈxR4‰ù⁄Ñj ˇ… gMÜÊ ®~‡c>∫s◊BAˇ·»IGÀ˛3ªYË@o9xˇˆßÖñ(ÚÇ˝˛V‹– ã⁄TA( ûsØæ>{Æ⁄RM˛§Íë2a˘«®„ÌŒù@√Ê∏ ¥ÈtNÜuØ˘æk›¿Úê踇R%Ë«π€®ÅŸ ¢YÕ◊`⁄o˘ãe˝s¥„îl0æÇ∫hÍÒedÈ∞g^h"An0˚H/˜¬R $Y∏ŸCEæ/˙ˇ§≤¶$“GÊA§wnÂñ'é[~›ãϱU˝‡-¯øö $û˚U|˜¯0⁄4¯ª‰ÜNNz†OÖ˛tbåùèZ√≥0(¿®ˆ ¤z≠Åx~mˇ}˙S]˚·ölk.∫≈ÿô/OV`ɉp]U¡o ¤Nu'[¥˘áπÙÁ2ñ€ç! ŒDRê8M„«x≈≈qfi•GÌèÙK ,d kQg≠E}ılå´#ô8Ù©?Â~
õ∫–Üá"€öıÎ
∂ÖHV5Ô}‹|ÏÂV¥
•›ZdÎÕ
cüsqÄfi}Ã58<ëq ƒöƒl ïÔ èıI≈º⁄•óR9Z/ í÷∫Ê©êyÂYŒ≤w VZ~N˘Y"D"!–¶√≠ª… ¨S‡¸Ê¯√ëâñ€f – ®  xÜ]T˚m§¿∆<:lŸmùô𕆩Cóm]MjÅWvy9«Ÿòµó∑ªÇÚ ∫5ûéÔL‡ù∂¨ù"M©;“Áã≠lÍA#ÈX[ã≥t$l∏C<≈?ïO +7kΩó·Ç†\0:‹fl‘∆Øâˇùˇ¥+!<º¡(Ÿ£UZà0Ÿ FÑOµ™$ï\ùz¬Mi/A†WÉb=à~¢?Q2ä/êhô•õ˘™ÿ I'QŸ=†u^’ΩÈ)÷2Mœ,CbÃfl≥ÒÜfØÊòæ=⁄2“r
M∞L Å3nB≠ó¤\‰p√¢…¨Y+?ã◊;ıÈÏØ^¡
ò§Óç9òæv¥c©ÑZÜj‚ÿ=º Ï$5Ÿ£§ÔÑe*Ÿ«BÇ8 flv. ‡fl1A#‹¤I9kπ†M—åÇ$¡ÍdãhEıbã[”kl}p8w⁄– MPÀ.p’»√ 4PÉ„°¿•(u;fiiÜÒGΩ§U&UR—◊“≠ö| ^ ÊôJAZcz'3ª≠úÁ„–}:.¬gÉÈõF˘Ø¶pr˙vÚ";kq[Äô ‰C\ÍÕV笺ïÙQ2Ã:/≥Á%õçÓÆÚãªø‹– ∞áËÃ8˝NHY‹“îãd%âÍ¥1•˝º‘‚°åÍçù ¥[82qfl∞πpâ≈›U÷+™±Å3Tï∆kV£‹ÄÒH¸Kÿ)9æ¶
f.RÁ'O欶Ÿñgfl≤bÅ m˙X≠¤j·±ÕÌUÕmK ¤Ã]Ê>•:«6_.˝å
Å≠~flfiàu€âÌÁq¥èNSa“¬Óå§{o≤+åT
ú~ÿ¿áB.té@¥ã‘∞®[À?N{îß.Ë´.≈òbÙ“xX °#sì≠Rf<¢Ô≈&Œƒ¢=Æ G≈Ωπ:ó±û6’yÁ
WüÂ’27tjÉ≈%‚Ø£¤Dé±8â˛Ë…≥
»;=‚zä}ãHiáÏúUêˆå¤‘Xé´§=ÇWÙ∂*∂®ïQÌ´œ$ɯ ‰V”X±ÇîáPÀ£fF˝;¥ºëÜ∑Õ†Ó»©√¶c| °k`˝Ôö`ÆJËï∞‡≤p1’àÔÀ∂* \≥ïπƒŒÿØ◊Jîâ3ø£á5·c ´4b0C≠¬)ºW8=•Ï∂∆ZsñJMJû^;8=|wy|ƒˆóJÌ 0“ËX´‘W ‚ª†~a~÷ä”M>è◊ §OÆP ˘∞πë*Ç"T5ª#õÿ,ØF‰Ò’S÷ßn,ˆ_æ†∞!óèc˚+ {jj9ÁSÿ∞oµÄ¡XgÿaP√oëö“•ùbM3Z˙– 7˝≠Ælfi˘Ay˘ñ3TË‚û¸%˛g à"+*Ê~â3Cï- ~zï*à3ÎOM'ìD˘·Õ±êAÙQÁ≈õ¿ÂóYõñ?/ Óf8ºˇΩÈ’öN#á!¨XAe≤Æß”ÓMâ~Å¡∏Ê ¤hƒ¯Èrbr≠ÃíÖyNWÅßp$p \L@ÌÉ(yÊ≤@≤ƒX§Ì<ë⁄ı™Zàœ2¤ufwüÏ ƒø˜bpEuT
_=dÈyµZ≠¶SBÆÂ©W⁄'Çeâ‘´TE.˙Yà’Dy(uˇb > %i†zókr‚+Lêï¶ØÁ¸"cå»Ãg@%≈s*´BNœ)Oπ( §Gòø›Òeˇ>ee
end HERE--------------------------------------------------------------


thank you
Sandro.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: escaping a string
      • From: "Michael Ash" <email@hidden>
  • Prev by Date: Re: Constant NSArray Count
  • Next by Date: Re: Finding other apps' paths - deterministically!
  • Previous by thread: Re: Core Data migration
  • Next by thread: Re: escaping a string
  • Index(es):
    • Date
    • Thread