Re: unicode bug in cheetah 2.2.0?

"R. Tyler Ballance" <[email protected]>
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
On Tue, May 19, 2009 at 12:35:07PM -0700, [email protected] wrote:
>    File "/home/mark/work/common/web/wsgiserver/__init__.py", line 1174, in
>    communicate
>        req.respond()
>      File "/home/mark/work/common/web/wsgiserver/__init__.py", line 544, in
>    respond
>        self._respond()
>      File "/home/mark/work/common/web/wsgiserver/__init__.py", line 556, in
>    _respond
>        response = self.wsgi_app(self.environ, self.start_response)
>      File "/home/mark/work/common/web/httpserver.py", line 201, in __call__
>        return self.app(environ, xstart_response)
>      File "/home/mark/work/common/beaker/middleware.py", line 159, in
>    __call__
>        return self.wrap_app(environ, session_start_response)
>      File "/home/mark/work/common/web/application.py", line 272, in wsgi
>        self.load(env)
>      File "/home/mark/work/common/web/application.py", line 371, in load
>        ctx[k] = safeunicode(v)
>      File "/home/mark/work/common/web/utils.py", line 231, in safeunicode
>        return obj.decode(encoding)
>      File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
>        return codecs.utf_8_decode(input, errors, True)
>    UnicodeDecodeError: 'utf8' codec can't decode bytes in position 17-20:
>    invalid data

Your "safeunicode" function and the "obj.encode()" function are the
likely culprits here. 

How this "should" work now within your web application is that unicode
is used internally throughout, and only if needed should it be encoded
to a utf-8 str() object (we have to encode, for example, for mod_python
to write to the socket properly)

This isn't Cheetah's unicode support, it's what hacks you had in place
to support unicode previously breaking.


Cheers
-- 
-R. Tyler Ballance
Slide, Inc.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkoTFOsACgkQFCbH3D9R4W+2PACeOFfpH64XhfEvYAAQyUkeMAei
mHoAn0nygw66HSWGNd2eDRWWWTJLzuqf
=d4TL
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.