Re: Save url containing special characters into mysql database using cursor object
please see functions urllib.quote, urllib.quote_plus, urllib.urlencode on this manual python [1]
[1] http://docs.python.org/2/library/urllib.html#utility-functions
Em sábado, 3 de agosto de 2013 16h04min55s UTC-3, fanchyna escreveu:
-- Em sábado, 3 de agosto de 2013 16h04min55s UTC-3, fanchyna escreveu:
I am about to save the url below to my mysql database (innodb) using the cursor object:
http://www-i6.informatik.rwth-
aachen.de/publications/ {o}{o}download/367/l fjonasbisanimaximiliangollanch risianheigoldgeorghoffmeisterb j{o}rnplahlchristianschl{u} terralfneyhermann--the2006{ rwth} parliamentaryspeechestranscrip tionsystem--2006.pdf the insert statement is
dbquery = "INSERT INTO maintable (url,state) VALUES (%s,%s)" dbqueryvalue = (url,'0') The cursor.execute(dbquery,dbquery
value )error:
_mysql_exceptions.Warning: Data truncated for column 'url' at row 1
Other urls seem to be OK, but on this one cannot be saved.The url field can save up to 255 characters so the string length is not the problem.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home