[IPython-dev] Buffers

Brian Granger ellisonbg at gmail.com
Mon Jul 26 22:25:37 EDT 2010


On Mon, Jul 26, 2010 at 6:12 PM, Fernando Perez <fperez.net at gmail.com>wrote:

> [ 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.
>
>
Yes, 0MQ and pyzmq should always deal with bytes.


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


> There is then the question of the receiving side: should it always
> decode? If not, should a flag about bytes/unicode be sent along?
>
>
That is really for an application to handle on a per message basis.  The
most reasonable options are:

1. Put encoding/decoding info in the message content.
2.  Always encode and decode in the application.

Brian


> Not sure...
>
> Cheers,
>
> f
>



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20100726/a5d29253/attachment.html>


More information about the IPython-dev mailing list