Re: [Zope3-dev] Publisher bug

2005-09-19 Thread Velko Ivanov

Roger Ineichen wrote:


Exception Type
UnicodeDecodeError
Exception Value
'ascii' codec can't decode byte 0xc3 in position 891: ordinal not in
range(128)
...
body = ('%s\nbase href=%s /\n%s' % 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 891:
ordinal not in range(128) 


I got plenty of these recently, but it was all my fault. I was trying to 
output some unicode strings with non-english characters and it took me 
some time until I got it right.
If you have strings in .py files, which contain non-english characters, 
try the following:


- save your .py files as utf8
- put a comment on the first, or second line of the file:
  # coding: utf8
  this takes care of python's warning
- decode all offending strings:
  'some string'.decode('utf8')




Regards,
Velko Ivanov
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



RE: [Zope3-dev] Publisher bug

2005-09-19 Thread Roger Ineichen
Hi Velko


 -Original Message-
 From: Velko Ivanov [mailto:[EMAIL PROTECTED] 
 Sent: Monday, September 19, 2005 12:57 PM
 To: [EMAIL PROTECTED]
 Cc: zope3-dev@zope.org
 Subject: Re: [Zope3-dev] Publisher bug
 
 Roger Ineichen wrote:
 
  Exception Type
  UnicodeDecodeError
  Exception Value
  'ascii' codec can't decode byte 0xc3 in position 891: ordinal not in
  range(128)
  ...
  body = ('%s\nbase href=%s /\n%s' % 
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in 
 position 891:
  ordinal not in range(128) 
 
 I got plenty of these recently, but it was all my fault. I 
 was trying to 
 output some unicode strings with non-english characters and 
 it took me 
 some time until I got it right.
 If you have strings in .py files, which contain non-english 
 characters, 
 try the following:
 
 - save your .py files as utf8
 - put a comment on the first, or second line of the file:
# coding: utf8
this takes care of python's warning
 - decode all offending strings:
'some string'.decode('utf8')

I see, I also run into such a error useing a textfile as a import
where I parse the lines and present them as content in a view.
Fix the encoding will work i this situation.

But my issue is more problematic because the same view on a object
will raise into this exception and a view on a copy of the object
will not raise this exception. After move the ZODB on another server
useing the same source code of z3 and our project the exception is gone.
Also the error is gone after restart on the main server where the error 
happens first.

The biggest problem right now is, that I can't reproduce the issue 
again after restart the server.

Regards
Roger Ineichen

Projekt01 GmbH
www.projekt01.ch
_
END OF MESSAGE  

 Regards,
 Velko Ivanov
 

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com