Hi! Ich habe gerade festgestellt das socket keine Umlaute übertragen kann. Wie kann man das Problem lösen ohne "teures" Parsen? Ich habe es noch nicht getestet, aber kann man über socket auch binär Dateien verschicken? Vermutlich nicht wenn socket schon bei Unicode ab kotzt. -- =================================================== "Meine Meinung steht fest. Bitte verwirren sie mich nicht mit Tatsachen!" Unbekannt. =================================================== _______________________________________________ Python-de maillist - Python-de@python.net http://python.net/mailman/listinfo/python-de
Wieso können Socken keine Umlaute übertragen? Bitte Code und Traceback zeigen...vorher glaub ich das nicht. -aj --On Donnerstag, 20. November 2003 14:24 Uhr +0100 Olaf 'Ruebezahl' Radicke <olaf_rad@gmx.de> wrote:
Hi! Ich habe gerade festgestellt das socket keine Umlaute übertragen kann. Wie kann man das Problem lösen ohne "teures" Parsen? Ich habe es noch nicht getestet, aber kann man über socket auch binär Dateien verschicken? Vermutlich nicht wenn socket schon bei Unicode ab kotzt.
_______________________________________________ Python-de maillist - Python-de@python.net http://python.net/mailman/listinfo/python-de
Am Don, 2003-11-20 um 14.31 schrieb Andreas Jung:
Wieso können Socken keine Umlaute übertragen?
Bitte Code und Traceback zeigen...vorher glaub ich das nicht.
Hier zwei versuche. In der ersten Zeile steht der String der übergeben werden soll: String: <?xml version="1.0" encoding="ISO-8859-1"?> <set_projekt_ziel projekt_titel="prob-umlaut">üöä</set_projekt_ziel> Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1345, in __call__ return self.func(*args) File "/home/olaf/Documents/src/gnuswork/sandbox/tk_gnuswork/gui_project_new.py", line 190, in _ok self.netz.set_projekt_ziel(project_title, projekt_ziel) File "/home/olaf/Documents/src/gnuswork/sandbox/tk_gnuswork/netmodul.py", line 44, in set_projekt_ziel self.my_socket.send(unicode(commant,"Latin-1").encode("utf-8")) TypeError: decoding Unicode is not supported ########################################## String: <?xml version="1.0" encoding="ISO-8859-1"?> <set_projekt_ziel projekt_titel="prob-x">äöü</set_projekt_ziel> Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1345, in __call__ return self.func(*args) File "/home/olaf/Documents/src/gnuswork/sandbox/tk_gnuswork/gui_project_new.py", line 190, in _ok self.netz.set_projekt_ziel(project_title, projekt_ziel) File "/home/olaf/Documents/src/gnuswork/sandbox/tk_gnuswork/netmodul.py", line 45, in set_projekt_ziel self.my_socket.send(commant) UnicodeEncodeError: 'ascii' codec can't encode characters in position 85-87: ordinal not in range(128) -- =================================================== "Meine Meinung steht fest. Bitte verwirren sie mich nicht mit Tatsachen!" Unbekannt. =================================================== _______________________________________________ Python-de maillist - Python-de@python.net http://python.net/mailman/listinfo/python-de
Das sieht ehr nach einem Unicodeproblem aus. Auf jedenfalls ist es möglich 8-bit Strings über eine Socket zu schicken....jedenfalls oft genug implementiert und erprobt. Könnte auch ein Problem in den TK Modulen sein. Das normale Socketmodul jedenfall funzt. -aj --On Donnerstag, 20. November 2003 15:14 Uhr +0100 Olaf 'Ruebezahl' Radicke <olaf_rad@gmx.de> wrote:
Am Don, 2003-11-20 um 14.31 schrieb Andreas Jung:
Wieso können Socken keine Umlaute übertragen?
Bitte Code und Traceback zeigen...vorher glaub ich das nicht.
Hier zwei versuche. In der ersten Zeile steht der String der übergeben werden soll:
String: <?xml version="1.0" encoding="ISO-8859-1"?> <set_projekt_ziel projekt_titel="prob-umlaut">üöä</set_projekt_ziel> Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1345, in __call__ return self.func(*args) File "/home/olaf/Documents/src/gnuswork/sandbox/tk_gnuswork/gui_project_new.py ", line 190, in _ok self.netz.set_projekt_ziel(project_title, projekt_ziel) File "/home/olaf/Documents/src/gnuswork/sandbox/tk_gnuswork/netmodul.py", line 44, in set_projekt_ziel self.my_socket.send(unicode(commant,"Latin-1").encode("utf-8")) TypeError: decoding Unicode is not supported
##########################################
String: <?xml version="1.0" encoding="ISO-8859-1"?> <set_projekt_ziel projekt_titel="prob-x">äöü</set_projekt_ziel> Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1345, in __call__ return self.func(*args) File "/home/olaf/Documents/src/gnuswork/sandbox/tk_gnuswork/gui_project_new.py ", line 190, in _ok self.netz.set_projekt_ziel(project_title, projekt_ziel) File "/home/olaf/Documents/src/gnuswork/sandbox/tk_gnuswork/netmodul.py", line 45, in set_projekt_ziel self.my_socket.send(commant) UnicodeEncodeError: 'ascii' codec can't encode characters in position 85-87: ordinal not in range(128)
_______________________________________________ Python-de maillist - Python-de@python.net http://python.net/mailman/listinfo/python-de
Olaf 'Ruebezahl' Radicke <olaf_rad@gmx.de> writes:
line 44, in set_projekt_ziel self.my_socket.send(unicode(commant,"Latin-1").encode("utf-8")) TypeError: decoding Unicode is not supported
Anscheinend ist 'commant' schon unicode, daher schlägt unicode(commant, "Latin-1") fehl. Also solltest Du self.my_socket.send(commant.encode("utf-8") probieren...
line 45, in set_projekt_ziel self.my_socket.send(commant) UnicodeEncodeError: 'ascii' codec can't encode characters in position
... und hier würde das wahrscheinlich auch helfen. Thomas _______________________________________________ Python-de maillist - Python-de@python.net http://python.net/mailman/listinfo/python-de
On 20 Nov 2003 15:14:24 +0100, Olaf 'Ruebezahl' Radicke <olaf_rad@gmx.de> wrote:
self.my_socket.send(unicode(commant,"Latin-1").encode("utf-8")) TypeError: decoding Unicode is not supported
so erhällt man die gleiche Fehlermeldung, vielleicht bringt Dich das auf eine Idee ;-)
unicode(u"abc","utf-8") Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: decoding Unicode is not supported
-- Mit freundlichen Grüßen Klaus Meyer :-) _______________________________________________ Python-de maillist - Python-de@python.net http://python.net/mailman/listinfo/python-de
participants (4)
-
Andreas Jung -
Klaus-G. Meyer -
Olaf 'Ruebezahl' Radicke -
Thomas Heller