David Beazley <d...@dabeaz.com> added the comment:

I encountered this issue is in the context of distributed 
computing/interprocess communication involving binary-encoded records (and 
encoding/decoding such records using struct). At its core, this is all about 
I/O--something where encodings and decoding matter a lot.  Frankly, it was 
quite surprising that a unicode string would silently pass through struct and 
turn into bytes.  IMHO, the fact that this is even possible encourages a sloppy 
usage of struct that favors programming convenience over correctness--something 
that's only going to end badly for the poor soul who passes non-ASCII 
characters into struct without knowing it. 

A default encoding might be okay as long as it was set to something like ASCII 
or Latin-1 (not UTF-8).  At least then you'd get an encoding error for 
characters that don't fit into a byte.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10783>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to