[BitTorrent] Re: bencoding 0:

Elliott Mitchell ehem at m5p.com
Mon Nov 22 20:33:21 EST 2004


>From: "skybuckflying" <skybuck2000 at hotmail.com>
> --- In BitTorrent at yahoogroups.com, Elliott Mitchell <ehem at m...> wrote:
> > >From: Olaf van der Spek <OvdSpek at L...>
> > > > Any string of digits is a valid string length (no one generates 
> strings
> > > > of length 0000, but it is valid by the spec).
> > > 
> > > That's not supposed to be valid.
> > 
> > "Strings are length-prefixed base ten followed by a colon and the 
> string.
> > For example 4:spam corresponds to 'spam'."
> > 
> > Sounds perfectly valid to me. Though I would support shooting 
> anyone who
> > created such strings by design.
> 
> For delphi it's no problem :)
> 
> ShowMessage( IntToStr( StrToInt( '000' ) ) );
> 
> This shows 0 :) without exceptions etc ;)
> 
> Though other languages might have problems converting string '0000' 
> to 0 :)
> 
> Test it ;)

This is amoung the more trivial Computer Science problems out there. Yes,
different languages may make it slightly easier or harder, but it is
still trivial. If you think handling this poses even the slightest
difficulty, then go away and don't come back until you know something.

Then again the little bit of code you sent to the list was either Delphi
or Modula 2/3/n (first thought was Pascal, but could of been Delphi). So
I don't see much future in your work here anyway.


Now my support for shooting anyone who made a client that emitted
bencoded of the form 00+: had nothing to do with the difficulty of the
problem. It had to do that making strings like that was a bad idea,
though it shouldn't cause problems with any well written client.

>From: skybuckflying <skybuck2000 at hotmail.com>
> 
> --- In BitTorrent at yahoogroups.com, Vitenka <vitenka at n...> wrote:
> > Just to add.
> > Character set encoding is an unsolved issue.  Sticking with the 
> 7bit 
> > basic ascii codes is your safest bet.  Some client replace anything 
> > other than a-z A-Z 0-9 _ with characters which are safe for that 
> > operating system.
> > 
> > This is good, because some non-english clients sned some very 
> strange 
> > characters - since they assume that the clients are all in their 
> native 
> > character set.
> 
> Yes this site also says ASCII 7 bit is most safest for data transfer
> 
> http://www.cs.tut.fi/~jkorpela/chars.html
> 
> However UTF 8 is recommended for data transfer in the internet.
> 
> I delved into this myself once and others also recommended UTF 8.

Good for you.

> Also the big benefit is that the lower 127 ASCII's characters are the 
> same for UTF 8.
> 
> So I would recommend UTF 8 as the encoding type for bittorrent lol.
> 
> A bit late... but better late than never.

BitTorrent deliberately chose to allow only ASCII filenames. Unless you
have a very *compelling* reason to change this, your energy is better
spent elsewhere as the decision has already been made.

> So ascii is still safest ;)

Which makes the decision at worst an annoyance for some folks and not a
bad decision. It has been made, live with it.

There are far more significant decisions coming up.


>From: "mayor_mccheese76" <mypublicaccount at yahoo.com>
> --- In BitTorrent at yahoogroups.com, "skybuckflying" <skybuck2000 at h...>
> wrote:
> > I would find it quite cool if my bittorrent... [...] 
> > would be able to store chinese filenames etc...
> 
> I don't find it specified in the wiki, but I've seen several torrents
> which have a "encoding" key in the root dictionary.  The value is a
> string specifying the desired encoding of the torrent data.  For
> example, "Cp1252".  Windows code page 1252 is the defacto standard
> english (ansi, ascii, whatever) encoding.

If you're using Windows. Luckily the decision was made to stick to ASCII
so those of us who choose to avoid that piece of garbage don't have a
problem.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \   (    |         EHeM at gremlin.m5p.com PGP 8881EF59         |    )   /
  \_  \   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
    \___\_|_/82 04 A1 3C C7 B1 37 2A*E3 6E 84 DA 97 4C 40 E6\_|_/___/




------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/BitTorrent/

<*> To unsubscribe from this group, send an email to:
    BitTorrent-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the BitTorrent mailing list