O
oziko
I solve the problem using
print str.encode('iso-8859-1')
Now I can print the tags with no aparent problem. But now whe I tried to
insert that value into a PostgreSQL data base I get the same error. I
create the PostgreSQL database with default Unicode with
createdb -E UNICODE oggtest
The data T am putting into de database si in the u'Perfeccion' format so
I understand it is UNICODE, but I get the same error:
Traceback (most recent call last):
File "./ogg2sql.py", line 82, in ?
db_cursor.execute(do)
File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 3035,
in execute
_qstr = self.__unicodeConvert(_qstr)
File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 2740,
in __unicodeConvert
return obj.encode(*self.conn.client_encoding)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in
position 102: ordinal not in range(128)
my insert query is:
tracks_insert_values =(unicode(coments['TITLE']),coments['TRACKNUMBER'])
y also tried with:
tracks_insert_values=(coments['TITLE'].encode('utf-8'),coments['TRACKNUMBER'])
insert_query = '''insert into tracks(titulo,no_pista)values(%s %i)''' %
tracks_insert_values
print str.encode('iso-8859-1')
Now I can print the tags with no aparent problem. But now whe I tried to
insert that value into a PostgreSQL data base I get the same error. I
create the PostgreSQL database with default Unicode with
createdb -E UNICODE oggtest
The data T am putting into de database si in the u'Perfeccion' format so
I understand it is UNICODE, but I get the same error:
Traceback (most recent call last):
File "./ogg2sql.py", line 82, in ?
db_cursor.execute(do)
File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 3035,
in execute
_qstr = self.__unicodeConvert(_qstr)
File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 2740,
in __unicodeConvert
return obj.encode(*self.conn.client_encoding)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in
position 102: ordinal not in range(128)
my insert query is:
tracks_insert_values =(unicode(coments['TITLE']),coments['TRACKNUMBER'])
y also tried with:
tracks_insert_values=(coments['TITLE'].encode('utf-8'),coments['TRACKNUMBER'])
insert_query = '''insert into tracks(titulo,no_pista)values(%s %i)''' %
tracks_insert_values