[Python-de] pyqt4: text ist utf-8, wird aber nicht richtig dargestellt

Reimar Bauer rb.proj at googlemail.com
Fr Jun 14 18:44:32 CEST 2013


Also eclipse setzt das encoding um, es ist nicht das default encoding das
man sonst hat.
Der thread sollte googlebar sein, evtl. Gibts auch was dazu im Wiki, hab
dazu schon mal was bei pyCologne erzählt.

Gruß
Reimar
Am 14.06.2013 16:35 schrieb "Wolfgang Meiners" <WolfgangMeiners01 at web.de>:

> Am 14.06.13 15:30, schrieb Walter Dörwald:
> > On 14.06.13 14:54, Wolfgang Meiners wrote:
> >> Am 14.06.13 13:59, schrieb Dinu Gherman:
> >>>> https://dl.dropboxusercontent.com/u/5015890/Beweisfotos/minimal.zip
> >>>
> >>> Ich versuche heut noch mal reinzuschauen...
> >>
> >> kann es sein, dass das Problem etwas mit utf-8 und utf-8-mac zu tun hat?
> >> In der minimal_ui.py steht folgende Funktion:
> >>
> >>      def retranslateUi(self, Dialog):
> >>          Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog",\
> >>          "Dialog", None, QtGui.QApplication.UnicodeUTF8))
> >>          self.label.setText(QtGui.QApplication.translate("Dialog",\
> >>          "Ätsch", None, QtGui.QApplication.UnicodeUTF8))
> >>
> >> die ich einfach mal ergänzt habe zu
> >>
> >>      def retranslateUi(self, Dialog):
> >>          Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog",\
> >>          "Dialog", None, QtGui.QApplication.UnicodeUTF8))
> >>          name='Ätsch'
> >>          self.label.setText(QtGui.QApplication.translate("Dialog",
> name,\
> >>          None, QtGui.QApplication.UnicodeUTF8))
> >>          print(bytes(name,'utf-8'))
> >>          print(bytes(self.label.text(),'utf-8'))
> >>
> >>
> >> Das führt -mit Eclipse gestartet- zur Ausgabe
> >> b'\xc3\x84tsch'
> >> b'\xc3\x84tsch'
> >>
> >> und im Terminal gestartet zur Ausgabe
> >> b'\xc3\x84tsch'
> >> b'\xef\xbf\xbdtsch'
> >>
> >> Aber wo steckt der Fehler?
> >
> > Hmm, b'\xef\xbf\xbd' ist ein "REPLACEMENT CHARACTER" in UTF-8. Evtl.
> > gibt's Probleme mit dem Encoding des Python-Skripts/Text-Editors?
> >
> > Schreib doch mal in Deinem Sourecode
> >
> >    name='\xc4tsch'
> >
> > statt
> >
> >    name='Ätsch'
> >
> > Servus,
> >    Walter
> >
> gerade gemacht. Das ändert nichts. Darstellungsfehler bei Aufruf im
> Terminal, korrekte Darstellung bei Aufruf in Eclipse. Also wenn ich das
> richtig verstehe: Der Buchstabe 'Ä' wird von _pyqt_ nicht korrekt
> erkannt und deshalb durch b'\xef\xbf\xbd' ersetzt. Wenn das so ist,
> warum erkennt pyqt das Zeichen nicht? Gibt es irgendwo eine
> Konfigurationsdatei, in der vielleicht ein anderes encoding
> festgeschrieben ist?
>
> Wolfgang
>
>
> _______________________________________________
> python-de maillist  -  python-de at python.org
> http://mail.python.org/mailman/listinfo/python-de
>
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <http://mail.python.org/pipermail/python-de/attachments/20130614/dafe8cf4/attachment-0001.html>


Mehr Informationen über die Mailingliste python-de