You need to read this in the context of the problem, no point having an abstract and therefore not relevant discussion.
I agree. But if the problem is that the model is an incorrect view of reality then it is the model which is the problem and it is the model has to change.
In E2, the files in a directory are enumerated in a list of serviceref objects, in which the path is an std::string, which is set from readdir() output. This is how the original sequence of bytes result from the filesystem ends up in a Python str object.
That is what is wrong. The original sequence of bytes has to end up in a Python bytes object, as it is not convertible into a str
This creates a sort of catch-22:
- the string can't be handled in python without causing a crash, in case the string doesn't contain utf-8
- it is not easy to convert the string if you don't know the original encoding (although you can guess using chardet, which OpenVIX has done, and I also implemented, but not committed yet)
- you can't alter the path in the serviceref itself, as that is also used to access the file, any conversion of that variable causes file access to fail
It's only a catch-22 if you try to make it a str. If you leave it as bytes the problem goes away (apart from displaying it, but that is a simpler issue).