[bittorrent] Bittorrent peer_id ASCII and Unicode?

Brett Cooper bac15 at uakron.edu
Tue Mar 14 22:20:04 EST 2006


Brian Dessent wrote:

>Brett Cooper wrote:
>
>  
>
>>2306 - 45
>>2307 U 85
>>2308 T 84
>>2309 1 49
>>2310 5 53
>>2311 0 48
>>2312 0 48
>>2313 - 45
>>2314 � 65533
>>2315 � 65533
>>2316 � 65533
>>2317 ? 56579
>>2318 � 65533
>>2319 ^B 2
>>2320 u 117
>>2321 F 70
>>2322 I 73
>>2323 � 65533
>>    
>>
>
>Something, either the HTTP server or client library you are using, is
>munging these values.  The peer ID is 20 bytes.  They are not encoded in
>any particular way, so attempting to interpret them as UTF-8 is wrong. 
>Don't treat them as characters, treat them as 20 raw octets.  It just
>happens that most clients pick 20 bytes that happen to be printable
>ascii, but this is coincidence.  You should not try to look for any
>encoding where there is none.  If you are getting 24 then something is
>horribly wrong.
>
>Brian
>_______________________________________________
>BitTorrent mailing list
>BitTorrent at lists.ibiblio.org
>http://lists.ibiblio.org/mailman/listinfo/bittorrent
>  
>
I believe the problem was caused by the cgi return value being encoded
into Unicode.  Simply reading byte by byte seemed to do the the trick
(seem to be getting 20 bytes now for peer_id's).



More information about the BitTorrent mailing list