Re: Unicode problems, yet again

2005-04-24 Thread "Martin v. Löwis"
Ivan Voras wrote: > Sorry, that was just steam venting from my ears - I often get bitten by > the "ordinal not in range(128)" error. :) I think I'm glad to hear that. Errors should never pass silently, unless explicitly silenced. When you get that error, it means there is a bug in your code (just

Re: Unicode problems, yet again

2005-04-24 Thread Ivan Voras
John Machin wrote: Just a thought: I noticed from the traceback that you are running this on a Windows box. Profound apologies in advance if this question is an insult to your intelligence, but you do know that Windows code page 1250 (Latin 2) -- which I guess is the code page that you would be usi

Re: Unicode problems, yet again

2005-04-24 Thread John Machin
On Sun, 24 Apr 2005 11:26:20 +0200, Ivan Voras <[EMAIL PROTECTED]> wrote: >Jp Calderone wrote: > >> You don't have a string fetched from a database, in iso-8859-2, alas. >> That is the root of the problem you're having. What you have is a >> unicode string. > >Yes, you're right :) I actually

Re: Unicode problems, yet again

2005-04-24 Thread Fredrik Lundh
Ivan Voras wrote: > One thing that I always wanted to do (but probably can't be done?) is to > set the default/implicit encoding to the one I'm using... You can hack this into site.py, or mess with sitecustomize.py, but I don't recommend it. > I often have to deal with 8-bit encodings and rarely

Re: Unicode problems, yet again

2005-04-24 Thread Ivan Voras
John Machin wrote: (Does anyone else feel that python's unicode handling is, well... suboptimal at least?) Your posting gives no evidence for such a conclusion. Sorry, that was just steam venting from my ears - I often get bitten by the "ordinal not in range(128)" error. :) -- http://mail.python

Re: Unicode problems, yet again

2005-04-24 Thread Ivan Voras
Jp Calderone wrote: You don't have a string fetched from a database, in iso-8859-2, alas. That is the root of the problem you're having. What you have is a unicode string. Yes, you're right :) I actually did have iso-8859-2 data, but, as I found out late last night, the data got converted to

Re: Unicode problems, yet again

2005-04-24 Thread Fredrik Lundh
Ivan Voras wrote: > I have a string fetched from database, in iso8859-2, with 8bit > characters, and I'm trying to send it over the network, via a socket: > >File "E:\Python24\lib\socket.py", line 249, in write > data = str(data) # XXX Should really reject non-string non-buffers > Unicode

Re: Unicode problems, yet again

2005-04-23 Thread John Machin
On Sun, 24 Apr 2005 03:15:02 +0200, Ivan Voras <[EMAIL PROTECTED]> wrote: >I have a string fetched from database, in iso8859-2, with 8bit >characters, "8bit characters"?? Maybe you did once, or you thought you did, but what you have now is a Unicode string, and socket.write() is expecting an ord

Re: Unicode problems, yet again

2005-04-23 Thread Kent Johnson
Ivan Voras wrote: I have a string fetched from database, in iso8859-2, with 8bit characters, and I'm trying to send it over the network, via a socket: File "E:\Python24\lib\socket.py", line 249, in write data = str(data) # XXX Should really reject non-string non-buffers UnicodeEncodeError:

Re: Unicode problems, yet again

2005-04-23 Thread Jp Calderone
On Sun, 24 Apr 2005 03:15:02 +0200, Ivan Voras <[EMAIL PROTECTED]> wrote: I have a string fetched from database, in iso8859-2, with 8bit characters, and I'm trying to send it over the network, via a socket: You don't have a string fetched from a database, in iso-8859-2, alas. That is the root o

Unicode problems, yet again

2005-04-23 Thread Ivan Voras
I have a string fetched from database, in iso8859-2, with 8bit characters, and I'm trying to send it over the network, via a socket: File "E:\Python24\lib\socket.py", line 249, in write data = str(data) # XXX Should really reject non-string non-buffers UnicodeEncodeError: 'ascii' codec can'