In the first example program I see:
# -*- coding: utf-8 -*-
I assume that this means that the encoding is UTF-8. (No?)
No, it means that the Python interpreter should assume the file is UTF-8 encoded and not strip out non-ASCII. You must ensure that the file is saved that way. If you are editing the file with emacs that same magic line will set the editor to the relevant mode. If you edit it with something else then you must ensure that is loads/saves text UTF-8 encoded and not, for example, using Latin 1 or a Windows-1252 (which will mangle the content).
Then you must tell Python to create Unicode strings from the string literals:
# These options all work for me
w.setWindowTitle(u'ПроÑтой') # note the preceding 'u'
w.setWindowTitle('ПроÑтой'.decode('utf-8'))
w.setWindowTitle(unicode('ПроÑтой', 'utf-8'))
# These options all work for me
w.setWindowTitle(u'ПроÑтой') # note the preceding 'u'
w.setWindowTitle('ПроÑтой'.decode('utf-8'))
w.setWindowTitle(unicode('ПроÑтой', 'utf-8'))
To copy to clipboard, switch view to plain text mode
and PyQt will do the correct thing with them.
Generally these fixed strings would be handled using Qt's translation mechanisms.
Bookmarks