Fix item sorting in NeighborList.

See #361.
Encode Content-Disposition header name properly.

PyQt <= 5.3 accepted a Python string containing only latin1 chars as argument
for a QByteArray. This is deprecated in 5.4 and will be removed in 5.5 so we
should encode it by hand here.