<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<BR> python script.py<BR><BR><BR>({'disc_id': 21L}, u'Sisteme de operare', u'C', u'L', u'R', 3.0, u'CA', 145.0, 5                           .0, '', 3.0, 0.0, 66.0, u'3s', '', u'po', u'Purdila O.', u'Purdil\u0103 O.', u'4                           CA', u'mi', u'11-14', u'EC101', 1, 1)<BR><BR><BR>Traceback (most recent call last):<BR>  File "script.py", line 47, in ?<BR>    db_writer.db_write_line(line,index_line)  #pass the line and its number<BR>  File "/home/projects/cspay/local-repo/branches/dodo/test-xlrd/db_writer.py", l                           ine 61, in db_write_line<BR>    cursor.executemany ("""INSERT INTO ore VALUES (%s,%s)""",[tuple_db,tuple_db]                           )<BR>  File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 199, in execu                           temany<BR>    qargs = db.literal(args)<BR>  File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 232, in l                           iteral<BR>    return self.escape(o, self.encoders)<BR>  File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 179, in u                           nicode_literal<BR>    return db.literal(u.encode(unicode_literal.charset))<BR>UnicodeEncodeError: 'latin-1' codec can't encode character u'\u0103' in position                            6: ordinal not in range(256)<BR>cspay@anaconda:~/local-repo/branches/dodo/test-xlrd$<BR><BR>Datele nu pot fi inserate in baza de date datorita faptului ca ele sunt unicode si in cazul in care nu sunt intre 0-255(ascii) imi da eroare<BR><BR>Ce se vede dupa comanda e rezultatul comenzii "print line" -&gt; anume cum sunt salvate datele de pe o linie din fisierul XLS intr-o lista<BR>(u-&gt;unicode)<BR><BR>Nu stiu care metoda e mai simpla si mai buna in cazul de fata ... Cert e ca am incercat mai multe dar fara rezultat<BR><BR>http://diveintopython.org/xml_processing/unicode.html<BR>import sys<BR>sys.setdefaultencoding('iso-8859-1') -&gt; da eroare cum ca nu exista functia<BR>#!/usr/bin/env python<BR># -*- coding: UTF-8 -*-<BR>title.encode('ascii','ignore')-&gt;nu a mers<BR><BR><BR><BR><BR><BR><BR><br /><hr />check out the rest of the Windows Live™.
More than mail–Windows Live™ goes way beyond your inbox.
 <a href='http://www.microsoft.com/windows/windowslive/' target='_new'>More than messages</a></body>
</html>