I am using Python 2. I believe my system relies on the default encoding not being changed to UTF-8 in many places. Is there a work-around to avoid using this line of code (from basexmpp.py)? I would gladly encode individual strings in SleekXMPP to UTF-8 (or ASCII if that is what is expected), but I do not know where in the SleekXMPP code theses changes would need to be added. Are there any other ideas of possible work-arounds? Or any guidance on how to hard-code Python 2 compatibility by encoding certain strings individually?
We've discussed changing some of the xmlstream reading/rewriting functions to load/install different versions depending on which version of Python you're using. This may not be enough, and needs a bit more research.
We may be able to get things to work without needing to duplicate everything by using:
# -*- coding: utf-8
from future import unicode_literals
It would obviate the need to use the 'u' prefix on strings, but it would be required in probably every file, especially ones defining stanza classes. Again, more research is needed. The main issue is just ensuring that user data is always Unicode.