Re: unicode and socket

2005-03-03 Thread TZOTZIOY
On 18 Feb 2005 19:10:36 -0800, rumours say that [EMAIL PROTECTED] might have written: >It's really funny, I cannot send a unicode stream throuth socket with >python while all the other languages as perl,c and java can do it. I don't know about perl. What I think you mean by unicode in C most pro

Re: unicode and socket

2005-02-19 Thread Fredrik Lundh
anonymous coward <[EMAIL PROTECTED]> wrote: > It's really funny, I cannot send a unicode stream throuth socket with > python while all the other languages as perl,c and java can do it. Are you sure you understand what Unicode is, and how sockets work? Sockets are used to transfer byte streams.

Re: unicode and socket

2005-02-19 Thread aurora
On 18 Feb 2005 19:10:36 -0800, <[EMAIL PROTECTED]> wrote: It's really funny, I cannot send a unicode stream throuth socket with python while all the other languages as perl,c and java can do it. then, how about converting the unicode string to a binary stream? It is possible to send a binary throug

Re: unicode and socket

2005-02-19 Thread Serge Orlov
[EMAIL PROTECTED] wrote: > It's really funny, I cannot send a unicode stream throuth socket with > python while all the other languages as perl,c and java can do it. You may really start laughing loudly after you find out that you can send arbitrary python objects over sockets. If you want langu

Re: unicode and socket

2005-02-18 Thread zyqnews
It's really funny, I cannot send a unicode stream throuth socket with python while all the other languages as perl,c and java can do it. then, how about converting the unicode string to a binary stream? It is possible to send a binary through socket with python? -- http://mail.python.org/mailman/

Re: unicode and socket

2005-02-18 Thread Lion Kimbro
You probably want to use UTF-16 or UTF-8 on both sides of the socket. See http://www.python.org/moin/Unicode for more information. So, we have a Unicode string... >>> mystring=u'eggs and ham' >>> mystring u'eggs and ham' Now, we want to send it over: >>> to_send=mystring.encode('utf-8') >>> to_s

Re: unicode and socket

2005-02-18 Thread Irmen de Jong
Irmen de Jong wrote: aurora wrote: You could not. Unicode is an abstract data type. It must be encoded into octets in order to send via socket. And the other end must decode the octets to retrieve the unicode string. Needless to say the encoding scheme must be consistent and understood by bot

Re: unicode and socket

2005-02-18 Thread Irmen de Jong
aurora wrote: You could not. Unicode is an abstract data type. It must be encoded into octets in order to send via socket. And the other end must decode the octets to retrieve the unicode string. Needless to say the encoding scheme must be consistent and understood by both ends. So use pickle

Re: unicode and socket

2005-02-18 Thread aurora
You could not. Unicode is an abstract data type. It must be encoded into octets in order to send via socket. And the other end must decode the octets to retrieve the unicode string. Needless to say the encoding scheme must be consistent and understood by both ends. On 18 Feb 2005 11:03:46 -0