This is fairly simple to do. What you have to implement is a python C extension that defines a cmp function that compares two unicode objects. Given that integrating it into calibre would be trivial.
In psedo-code the thing would look like:
Code:
function set_collation(lang_code) {
...
}
function cmp(a, b) {
return a - b; //Where a -b means return -1 if a < b, +i if a > b and 0 if a==b
}
It should be possible to link the extension against ICU and use that to implement cmp, though that would require that ICU be compilable on win/linux/osx.