usage of <string>.encode('utf-8','xmlcharrefreplace')?
J Peyret
jpeyret at gmail.com
Tue Feb 19 01:24:56 EST 2008
OK, txs a lot. I will have to think a bit more about you said, what I
am doing and how encode/decode fits in.
You are right, I am confused about unicode. Guilty as charged.
I've seen the decode+encode chaining invoked in some of the examples,
but not the rationale for it.
Also doesn't help that I am not sure what encoding is used in the data
file that I'm using.
I didn't set out to "hide" the original error, just wanted to simplify
my error posting, after having researched enough to see that
encode/decode was part of the solution.
Adding the db aspect to the equation doesn't really help much and I
should have left it out entirely.
FWIW:
<class 'psycopg2.ProgrammingError'>
invalid byte sequence for encoding "UTF8": 0x92
HINT: This error can also happen if the byte sequence does not match
the encoding expected by the server, which is controlled by
"client_encoding".
column is a varchar(2000) and the "guilty characters" are those used
in my posting.
Txs again.
More information about the Python-list
mailing list