montanaro at users.sourceforge.net wrote: > 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4