Ich verarbeite utf-8 Strings aus Webseiten.
Da ich Teile davon im Statusbar ausgebe, wandle ich sie
in iso-8859-1 um, da ich bei einigen Zeichen sonst Fehlermeldungen bekomme. Klappt auch.
Kontrollausgabe der Umwandlung (utf-8 -> Unicode -> iso-8859-1):
Code: Alles auswählen
Original <type 'str'>
Unicode <type 'unicode'>
ISO <type 'str'>
Und da bekomme ich ständig einen Unicode-Error. Der Typ ist String
<str> und trotzdem die Fehlermeldung:
Code: Alles auswählen
TypeError: String or Unicode type required
Hier der Code:
Code: Alles auswählen
print type(SJ.about['names'])
text1 = SJ.about['names']
wx.StaticText(self, -1, (5,10), text1)
Code: Alles auswählen
<type 'str'>
Traceback (most recent call last):
File "CheckArtist.py", line 274, in OnEnterPanel3
AAW = AboutArtistWin()
File "CheckArtist.py", line 1797, in __init__
wx.StaticText(self, -1, (5,10), text1)
File "C:\Programme\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_controls.py", line 1136, in __init__
_controls_.StaticText_swiginit(self,_controls_.new_StaticText(*args, **kwargs))
TypeError: String or Unicode type required
Befreit mich bitte von dem Wahnsinn, bevor ich irre werde
Gruß, Seven