split problem if the delimiter is inside the text limiter

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Wed Mar 18 17:46:13 EDT 2009


rewonka a écrit :
(snip)
> Now i stucked when i tried to pu into db.
> Because i have some cell that is in somekind of unicoded text,

You mean "encoded in something else than utf8" ?

> and i'm
> looking a solution how to put this into db (my db in utf-8 format).

(snip)

> but something binary in a cell, the pgdb says it is not in utf-8
> format, or something like this.

You have to know the original encoding (I mean, the one used for the csv 
file), else there's nothing you can do. Then it's just a matter of 
decoding (to unicode) then encoding (to utf8), ie (if your source is in 
latin1):

utf_string = latin1_string.decode("latin1").encode("utf8")



More information about the Python-list mailing list