Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22325
Modified Files:
libcsv.tex Log Message:
add UnicodeReader and UnicodeWriter example classes
[....] +The \module{csv} module doesn't directly support reading and writing +Unicode, but it is 8-bit clean save for some problems with \ASCII{} NUL +characters, so you can write classes that handle the encoding and decoding +for you as long as you avoid encodings like utf-16 that use NULs.
The problem is more the fact that UTF-16 would require a stateful codec.
For the UnicodeWriter IMHO the best solution would be to make the csv module unicode transparent (i.e. it simply calls the write method of the underlying stream). Then it should be possible to stack the streams like this:
import csv, codecs
w = cvs.writer(codecs.getwriter("utf-16")(open("foo.csv", "wb")) w.writerow([u"foo", u"bar")]
If csv was implemented in Python this would be trivial.
Bye, Walter Dörwald _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com