[IPython-dev] Buffers

Fernando Perez fperez.net at gmail.com
Mon Jul 26 21:12:35 EDT 2010


[ I'm cc'ing the list on this, which may be of general interest ]

On Mon, Jul 26, 2010 at 2:14 PM, MinRK <benjaminrk at gmail.com> wrote:
> Basically, the question revolves around what should we do with non-ascii
> unicode messages in this situation:
> msg=u'รง'
> a.send(msg)
> s = b.recv()

Shouldn't send/receive *always* work with bytes and never with
unicode?  Unicode requires knowing the encoding, and that is a
dangerous proposition on two sides of the wire.

If a message is unicode, it should be encoded first (to utf-8) and
decoded on the other side back to unicode.

There is then the question of the receiving side: should it always
decode? If not, should a flag about bytes/unicode be sent along?

Not sure...

Cheers,

f



More information about the IPython-dev mailing list