I had this problem recently. It turned out that something
had encoded a unicode string into utf-8. When I found
the culprit and fixed the underlying design issue, it went away.

John Roth



"jdonnell" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
I have a mysql database with characters like � � » in it. I'm
trying to write a python script to remove these, but I'm having a
really hard time.


These strings are coming out as type 'str' not 'unicode' so I tried to
just

record[4].replace('�', '')

but this does nothing. However the following code works

#!/usr/bin/python

s = 'aaaaa � aaa'
print type(s)
print s
print s.find('�')

This returns
<type 'str'>
aaaaa � aaa
6

The other odd thing is that the � character shows up as two spaces if
I print it to the terminal from mysql, but it shows up as � when I
print from the simple script above.
What am I doing wrong?

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to