Re: encoding problem with BeautifulSoup - problem when writing parsed text to file

On Thu, Oct 6, 2011 at 3:39 PM, Greg <gregor.hochschild@xxxxxxxxxxxxxx> wrote:
Brilliant! It worked. Thanks!

Here is the final code for those who are struggling with similar

## open and decode file
# In this case, the encoding comes from the charset argument in a meta
# e.g. <meta charset="iso-8859-2">
fileContent = fileObj.decode("iso-8859-2")

In other words, when you decode correctly into Unicode and encode
correctly onto the disk, it works!

This is why encodings are so important :)