How can I convert data encoded in WE8MSWIN1252 to utf8 for use in Python scripts?

Posted by James Dean on Stack Overflow See other posts from Stack Overflow or by James Dean
Published on 2010-05-25T13:08:02Z Indexed on 2010/05/25 13:11 UTC
Read the original article Hit count: 369

Filed under:
|
|
|

This data comes from an Oracle database and is extracted to flatfiles in encoding 'WE8MSWIN1252'.

I want to parse the data and do some analysis. I want to see the text fields but do not need to publish the results to any other system so if some characters do not get converted perfectly I do not have a problem with that.

I just do not want my parsing to fail with a decode error which is what I get if I use:

inputFile = codecs.open( dataFileName, "r", "utf-8'")

© Stack Overflow or respective owner

Related posts about python

Related posts about Oracle