469,919 Members | 2,091 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,919 developers. It's quick & easy.

how to store and still search special characters in Python and MySql

I have an MySQL database called zingers. The structure is:

zid - integer, key, autoincrement
keyword - varchar
citation - text
quotation - text

I am having trouble storing text, as typed in latter two fields.
Special characters and punctuation all seem not to be stored and
retrieved correctly.

Special apostrophes and single quotes from Microsoft Word are causing
a
special problem, even though I have ''ed all 's

perhaps the encoding of the database itself should be different? it
is
currenlty latin_swedish_ci

Input and output is through a browser.

I think my problem may be that I need to encode the string before
saving it in the databse. Can anyone point me in the right direction
here?

here's the error message:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
95: ordinal not in range(128)
args = ('ascii', "update zingers set keywords =
'a;Action;b;Religi... \n \n \n ' where zid = 422", 95, 96, 'ordinal
not
in range(128)')
encoding = 'ascii'
end = 96
object = "update zingers set keywords = 'a;Action;b;Religi...
\n
\n \n ' where zid = 422"
reason = 'ordinal not in range(128)'
start = 95

the characters I am trying to add are startquote and endquote copied
and pasted from Microsoft Word.

Can anyone help me on this?

bests,

-rsr-

Feb 12 '07 #1
1 1552
On Feb 12, 12:26 pm, "ronrsr" <ron...@gmail.comwrote:
I have an MySQL database called zingers. The structure is:
<snip>
I am having trouble storing text, as typed in latter two fields.
Special characters and punctuation all seem not to be stored and
retrieved correctly.

Special apostrophes and single quotes from Microsoft Word are causing
a
special problem, even though I have ''ed all 's
<snip>
>
Input and output is through a browser.
<snip>
>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
95: ordinal not in range(128)
args = ('ascii', "update zingers set keywords =
'a;Action;b;Religi... \n \n \n ' where zid = 422", 95, 96, 'ordinal
not
in range(128)')
encoding = 'ascii'
end = 96
object = "update zingers set keywords = 'a;Action;b;Religi...
\n
\n \n ' where zid = 422"
reason = 'ordinal not in range(128)'
start = 95

the characters I am trying to add are startquote and endquote copied
and pasted from Microsoft Word.
<snip>

http://tinyurl.com/2g9364

as nobody has replied yet...perhaps the above link may help

Feb 15 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Ruby Tuesday | last post: by
5 posts views Thread by Doc | last post: by
9 posts views Thread by Larry | last post: by
reply views Thread by Luis Corrales | last post: by
3 posts views Thread by cheesecaker | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.