I was able to go a bit further with the script below. Unfortunately
when that utf-8-encoded mysql-escaped string goes back up into MySQLdb
I get hit by another encoding error inside MySQLdb. So my best for the
moment is to stay with my current implementation which escapes all
strings to html decimal entities.



#!/usr/bin/python

import os, sys
import MySQLdb
from types import StringType,UnicodeType

a='\'And"ré'

try:
  b=unicode(a,'utf-8')
except:
  b=unicode(a,'latin-1')

print b.encode('latin-1')
print b.encode('utf-8')

print MySQLdb.escape_string(b.encode('utf-8'))



-- Fil
_______________________________________________
Mailman-Developers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to