how to write file with cp1250 encodings?

Magnus Lycka lycka at carmen.se
Wed Mar 1 08:07:25 EST 2006


Grzegorz Smith wrote:
> Hi all. I have got situation: i load data from database(MSSQL) wchich are
> encoded cp1250 

Are you sure that you are getting cp1250 from the database?
How do you communicate with the database? With the database
APIs I used in Windows, I always got Unicode objects from
databases, how ever things were internally stored in the DB.

If you have just managed to get your data correctly into
Unicode objects, you can convert them into whatever code
page you like with the .encode(encoding) method. Just make
sure you encode with the same encoding that yo state in
the meta element charset attribute.




More information about the Python-list mailing list