escaping a string
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Ç8flv.
‡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