473,549 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_c i

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:

UnicodeDecodeEr ror: 'ascii' codec can't decode byte 0xe2 in position
95: ordinal not in range(128)
args = ('ascii', "update zingers set keywords =
'a;Action;b;Rel igi... \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;Rel igi...
\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 1761
On Feb 12, 12:26 pm, "ronrsr" <ron...@gmail.c omwrote:
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>
>
UnicodeDecodeEr ror: 'ascii' codec can't decode byte 0xe2 in position
95: ordinal not in range(128)
args = ('ascii', "update zingers set keywords =
'a;Action;b;Rel igi... \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;Rel igi...
\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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2562
by: Ruby Tuesday | last post by:
How do I transfer my MS Access DB to MySQL? One issue though, in Access I have some special character such fraction, backquote, etc ... how do I replace those characters to ASCI equivalent when transfering to MySQL, or do I have to do it outside MySQL? Thanks
4
5249
by: Ewok | last post by:
let me just say. it's not by choice but im dealing with a .net web app (top down approach with VB and a MySQL database) sigh..... Anyhow, I've just about got all the kinks worked out but I am having trouble preserving data as it gets entered into the database. Primarily, quotes and special characters. Spcifically, I noticed it stripped...
5
3665
by: Doc | last post by:
Hello! I'm experiencing a little problem counting the number of characters in a textarea on a html page. This is the content type of my HTML document content="text/html; charset=iso-8859-1" I have a textarea that I want to limit to 400 characters, but the enduser can enter special characters (like €, v, 8, ...). I have
9
2554
by: Larry | last post by:
OK, I've been searching around the net for numerous hours and seem to just be getting more confused about handling special characters. In my host's configuration MagicQuotes is ON. (I understand this is considered a bad thing by many) A user submitted an email in the form 'Bob Smith' <bob@nospam.com> Now when I look in the MySql database...
0
1514
by: Luis Corrales | last post by:
Hi all, I have a problem when searching for text with special characters in e-mails in an IMAP server. I'm using imaplib in python 2.4.3 and I can't get this code working: # first connect and login conn = IMAP4(my_server) conn.login(my_user, my_pass)
3
1988
by: cheesecaker | last post by:
When I INSERT special characters into my MySQL database, they become distorted. For example, an accented e becomes "é". The database is set to utf8/utf8_general_ci, and so is the table and column I'm entering the data to. As far as I know, it should work. The form I'm loading the data from is a page that has its content-type set to utf-8, so...
2
2151
by: Raju1984 | last post by:
If i store the string which contains special characters(®) in MySQL database ,it stores special characters as it is. But when i try to diplay that string using HTML & queries, it shows '?' character for ® in Firefox & shows some another character in Internet Explorer. Please try to answer that!
2
5632
by: Ravigandha | last post by:
Hello everybody, My question is how to insert special characters and symbols in Mysql5 database and how to retrieve them from database in php. Here i am inserting some data from a form,by post method like $data=$_post; after this i am inserting in database, mysql_query("insert into tbl_name(column name) values('$data')"); Everthing working...
1
4190
by: ArizonaJohn | last post by:
Hello, I would like to allow users to add tables to my database with special characters in the table names. The characters I would like to allow include #, &, *, and +. Below is my code which allows the users to create tables, and the name is the variable "$name". How can I allow them to use special characters for the table names? ...
0
7520
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7450
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.