Description
URLs encode bytes. Usually, children of elements and elements of collections have Unicode identifiers, though. Currently this is "fixed" by Python's implicit decoding, which is pretty bad.
Since URLs are an implementation detail of being accessed over HTTP, this belongs in {Collection,Element}Resource
.
There should be a test that tries a non-ASCII name first, and verifies that it works when you use lambda s: s.decode("utf-8")
as a key function.
Whether the default should be lambda s: s.decode("utf-8")
or lambda s: s
(or perhaps a special-cased None) is an open question. UTF-8 is probably the only sane default encoding. The API should provide a keyfunc and not an encoding, because using int as a key function for example might make perfect sense.