encoding problem with BeautifulSoup - problem when writing parsed text to file
Ulrich Eckhardt
ulrich.eckhardt at dominalaser.com
Thu Oct 6 05:29:21 EDT 2011
Am 06.10.2011 05:40, schrieb Steven D'Aprano:
> (4) Do all your processing in Unicode, not bytes.
>
> (5) Encode the text into bytes using UTF-8 encoding.
>
> (6) Write the bytes to a file.
Just wondering, why do you split the latter two parts? I would have used
codecs.open() to open the file and define the encoding in a single step.
Is there a downside to this approach?
Otherwise, I can only confirm that your overall approach is the easiest
way to get correct results.
Uli
More information about the Python-list
mailing list