Message11625

Author jeff.allen
Recipients jeff.allen
Date 2017-10-21.07:16:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1508570174.74.0.213398074469.issue2632@psf.upfronthosting.co.za>
In-reply-to
Content
As reported in https://github.com/jythontools/jython/issues/90, an attempt to write non-ascii text via csv results in the infamous:

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Cannot create PyString with non-byte value

Being old-school Python 2, this module thinks in bytes and leaves encoding to the user. By convention (?), the content of a CSV will be interpreted as UTF-8, so clients sensitive to the problem will supply encoded data. We reverse this philosophy in Python 3.

Almost certainly we should use a ByteBuffer where we presently use a StringBuilder since the file is in binary mode and the user should expect to encode the text before calling csv.writer.writerow().
History
Date User Action Args
2017-10-21 07:16:14jeff.allensetrecipients: + jeff.allen
2017-10-21 07:16:14jeff.allensetmessageid: <1508570174.74.0.213398074469.issue2632@psf.upfronthosting.co.za>
2017-10-21 07:16:14jeff.allenlinkissue2632 messages
2017-10-21 07:16:13jeff.allencreate