Re: problems with  character
From: John Roth (newsgroups_at_jhrothjr.com)
Date: 03/23/05
- Next message: Ron: "Re: Anonymus functions revisited"
- Previous message: Uche Ogbuji: "Re: how to use structured markup tools"
- In reply to: jdonnell: "problems with  character"
- Next in thread: Bengt Richter: "Re: Re: problems with  character"
- Reply: Bengt Richter: "Re: Re: problems with  character"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 22 Mar 2005 20:09:55 -0600
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" <jaydonnell@gmail.com> wrote in message
news:1111521139.657563.55410@o13g2000cwo.googlegroups.com...
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?
- Next message: Ron: "Re: Anonymus functions revisited"
- Previous message: Uche Ogbuji: "Re: how to use structured markup tools"
- In reply to: jdonnell: "problems with  character"
- Next in thread: Bengt Richter: "Re: Re: problems with  character"
- Reply: Bengt Richter: "Re: Re: problems with  character"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|