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

R

ronrsr

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-
 
J

Justin Ezequiel

I have an MySQL database called zingers. The structure is:
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
Input and output is through a browser.
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top