Comment 15 for bug 1069019

Sami Jaktholm (sjakthol) wrote :

This bug is actually caused by python-apt which tries to open the sourceslist files with the default encoding.

As the dbus daemon backend is executed in a clean environment, the default encoding is not the same the system uses - it's the one hardcoded to python if every detection method fails (and that's not UTF-8). The backend fails to open files with unicode chars and ignores the sources inside them.

However, the GUI runs in an user session that has UTF-8 as default encoding. Thus the frontend is able to read the files and show the sources in them. When user tries to toggle or edit the sources, the backend fails to find the entry to toggle (as it was ignored) and nothing happens (well, backend throws an exception which the frontend quietly ignores).

So yes, the solution is very trivial: just make python-apt open all sourceslist files with UTF-8 encoding. However, the tricky part is to get it to work in both Python 2 and 3...