[bittorrent] BEncodedDictionary must have ordered keys... whatdefinition of "ordered"?
alan.mcgovern at gmail.com
Wed Oct 25 16:33:36 EDT 2006
Thats exactly what i was trying to find out. The spec definately didn't
clearly spell out what kind of sort was being used. I assumed that a normal
string.compare() would be sufficient. Obviously not, as it takes culture
I'll update the spec on wiki.theory.org to make sure that point is clearly
made. I've now switched to a string.CompareOrdinal() which does a binary
comparison and everythings ok.
On 10/25/06, Brian Dessent <brian at dessent.net> wrote:
> Alan McGovern wrote:
> > Now, the problem is that the MS.NET framework defines that to be in
> > non-alphabetical order as according to the String.Compare method in
> > it, '-' should come after '.' So, which is right, .NET or BitComet?
> > Also, there must be a standardised way of deciding which letters come
> > before which that we can compare against. Anyone know where to find
> > such a list?
> This is not rocket science, and the fact that this would be confusing
> really seems rather worrysome. '-' is ascii 0x2d, '.' is ascii 0x2e,
> therefore in a strictly binary-based comparison, - comes first. And
> that is what the spec defines, a strict lexicographical sort.
> The reason .Net is sorting differently is it is not doing a binary sort,
> it is doing a sort based on the setting of the current locale, which
> defines a collation order that gives a natural sort order for that
> culture/locale. So either set the locale to C/Posix or use a binary
> sort and not a natural sort.
> BitTorrent mailing list
> BitTorrent at lists.ibiblio.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the BitTorrent