Hi ! I want to get the WMI infos from Windows machines. I use Py from HU (iso-8859-2) charset.
Then I wrote some utility for it, because I want to write it to an XML file. def ToHU(s,NoneStr='-'): if s==None: s=NoneStr if not (type(s) in [type(''),type(u'')]): s=str(s) if type(s)<>type(u''): s=unicode(s) s=s.replace(chr(0),' '); s=s.encode('iso-8859-2') return s This fn is working, but I have been got an error with this value: 'Kommunik\xe1ci\xf3s port (COM1)' This routine demonstrates the problem s='Kommunik\xe1ci\xf3s port (COM1)' print s print type(s) print type(u'aaa') s=unicode(s) # error ! This is makes me mad. How to I convert every objects to string, and convert (encode) them to iso-8859-2 (if needed) ? Please help me ! Thanx for help: ft -- http://mail.python.org/mailman/listinfo/python-list