this is all over the list, and there are probably some solutions and
problems I don't know about.  But ... believe it or not, adding these
lines to my sitecustomize.py solved all the UnicodeDecodeError
exceptions I ever got with kid (fingers crossed):

import sys
sys.setdefaultencoding('iso-8859-1')

in theory, this will only work if the text you are typing / inputting
in your templates is iso-8859-1.

sitecustomize.py gets automatically imported as long as it is
somewhere in your pythonpath.  There is also more info here :
http://diveintopython.org/xml_processing/unicode.html

On 2/14/06, Rocco <[EMAIL PROTECTED]> wrote:
>
> I made a page with kid.
> It imports a module which uses feedparser (universal feed parser
> version 4.01) to summarize some atom feeds and rss2 feeds in the
> template page.
> Feedparser uses unicode internally so when I pass unicode string to kid
> no problem should be.
> But it's not so.
> Here is the traceback from python:
> Traceback (most recent call last):
>   File "<pyshell#136>", line 1, in -toplevel-
>     tmp.write(file=p+'blogs.html')
>   File
> "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\__init__.py", line
> 209, in write
>     return serializer.write(self, file, encoding, fragment)
>   File
> "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\serialization.py",
> line 58, in write
>     for text in self.generate(stream, encoding, fragment):
>   File
> "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\serialization.py",
> line 149, in generate
>     for ev, item in self.apply_filters(stream):
>   File
> "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\serialization.py",
> line 77, in balancing_filter
>     for ev, item in stream:
>   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
> line 203, in _coalesce
>     for ev, item in stream:
>   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\filter.py",
> line 21, in transform_filter
>     for ev, item in apply_matches(stream, template, templates,
> apply_func):
>   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\filter.py",
> line 25, in apply_matches
>     for ev, item in stream:
>   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
> line 164, in _track
>     for p in stream:
>   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
> line 211, in _coalesce
>     text += to_unicode(value, encoding)
>   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
> line 187, in to_unicode
>     return unicode(value, encoding)
>   File "C:\python24\lib\encodings\utf_8.py", line 16, in decode
>     return codecs.utf_8_decode(input, errors, True)
> UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 23:
> unexpected end of data
>
> I don't know why and you?
> Thanks for the attention
>
> Rocco
>
>

Reply via email to