Re: 'ascii' codec can't encode character u'\xe4' in position 4: ordinal not in range(128)

2009-11-08 Thread Ben Finney
balavignesh writes: > Whats the wrong in my code? Without seeing your code, all we could do is guess, poorly. Far better would be if you can construct a very small example, one that you post here so any reader here could run it, that demonstrates the behaviour you want explained. Don't forget t

Re: Ascii codec can't encode

2008-10-30 Thread Ulrich Eckhardt
luca72 wrote: > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in > position 8: ordinal not in range(128) > > I have solve in this way: > > file_ricerca = codecs.open('ri', 'wb', 'ISO-8859-15', 'repalce') That should be 'replace' instead of 'repalce', I assume you just mistyped

Re: Ascii codec can't encode

2008-10-30 Thread luca72
the arror are: >>> Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/ DebugClientBase.py", line 1006, in __unhandled_exception self.mainThread.user_exception(None, (exctype,excval,exctb), 1) File "/usr/lib/python2.5

Re: Ascii codec can't encode

2008-10-30 Thread Marc 'BlackJack' Rintsch
On Thu, 30 Oct 2008 03:01:07 -0700, luca72 wrote: > the code is this > # -*- coding: ISO-8859-1 -*- > from BeautifulSoup import BeautifulSoup import urllib > sito = urllib.urlopen('http://text.net/') esamino = BeautifulSoup(sito) > luca = esamino.findAll('tr', align='center') lunghezza = len(luca)

Re: Ascii codec can't encode

2008-10-30 Thread luca72
Hello Again the code is this # -*- coding: ISO-8859-1 -*- from BeautifulSoup import BeautifulSoup import urllib sito = urllib.urlopen('http://text.net/') esamino = BeautifulSoup(sito) luca = esamino.findAll('tr', align='center') lunghezza = len(luca) messaggio_per_scar = open('me', 'wb') file_rice

Re: Ascii codec can't encode

2008-10-30 Thread Ulrich Eckhardt
luca72 wrote: > Hy the code is this: > > Pok\xe9mon That's not what I meant, I meant a piece of Python source code. This piece has to be large enough to demonstrate the problem but with everything else removed. The point is that guessing what is wrong in your program is just futile; In order to h

Re: Ascii codec can't encode

2008-10-30 Thread luca72
On 30 Ott, 10:27, luca72 <[EMAIL PROTECTED]> wrote: > Hy the code is this: > > Pok\xe9mon > > Luca Sorry is the é -- http://mail.python.org/mailman/listinfo/python-list

Re: Ascii codec can't encode

2008-10-30 Thread luca72
Hy the code is this: Pok\xe9mon Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: Ascii codec can't encode

2008-10-30 Thread Ulrich Eckhardt
luca72 wrote: > hello i have this problem: > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in > position 8: ordinal not in range(128) This is the result of transcoding a Unicode string to ASCII, where the Unicode string contains a character that is not representable in ASCII. Th

Re: 'ascii' codec can't encode character u'\u2013'

2005-09-30 Thread John J. Lee
deelan <[EMAIL PROTECTED]> writes: [...] > query = "UPDATE blogs_news SET text = %s WHERE id=%s" > cursor.execute(query, (text_extrated, id)) > > so mysqldb will take care to quote text_extrated automatically. this > may not not your problem, but it's considered "good style" when dealing > with db

Re: 'ascii' codec can't encode character u'\u2013'

2005-09-30 Thread thomas Armstrong
Hi. Thank you both for your answers. Finally I changed my MySQL table to UTF-8 and changed the structure of the query (with '%s'). It works. Thank you very much. 2005/9/30, deelan <[EMAIL PROTECTED]>: > thomas Armstrong wrote: > (...) > > when trying to execute a MySQL query: > > > > query

Re: 'ascii' codec can't encode character u'\u2013'

2005-09-30 Thread deelan
thomas Armstrong wrote: (...) > when trying to execute a MySQL query: > > query = "UPDATE blogs_news SET text = '" + text_extrated + "'WHERE > id='" + id + "'" > cursor.execute (query) #<--- error line > well, to start it's not the best way to do an update, try this instead: query = "U

Re: 'ascii' codec can't encode character u'\u2013'

2005-09-30 Thread Fredrik Lundh
Thomas Armstrong wrote: > I'm trying to parse a UTF-8 document with special characters like > acute-accent vowels: > > > ... > --- > > But I get this error message: > --- > UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in > position 122: ordinal not in range(