[bittorrent] Bittorrent peer_id ASCII and Unicode?

Brian Dessent brian at dessent.net
Tue Mar 14 15:14:46 EST 2006


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



More information about the BitTorrent mailing list