I spend all my night to look source code....
I found the decodingfilter do not be called.
def decode(self, enc):
decodedParams = {}
raise 'test'
I add piece code the test does TurboGears decode data by
DecodingFilter.
But it is strange. Cherrypy never reach, "raise 'test'" this line.
Unless I add this to my root controller
from cherrypy.filters.decodingfilter import DecodingFilter
class Root(controllers.RootController):
_cp_filters = [DecodingFilter(),]
And then cherrypy use DecodingFilter to do his job.
But this cause UnicodeEncodeError: 'ascii' codec can't encode
characters in position 0-1: ordinal not in range(128)
Because another strange thing is : All parameters goes into
DecodingFilter are all unicode string.
So if the DecodingFilter work. It double decode the unicode string.
Now I am going to see who decode parameters before DecodingFilter.
And who encode parameters again.
On 1月17日, 下午5時49分, "Florent Aide" <[EMAIL PROTECTED]> wrote:
> 2008/1/17 Victor <[EMAIL PROTECTED]>:
>
>
>
> > Request Headers:
> > REFERER:http://127.0.0.1/offline/article_editor/?article_id=31
> > KEEP-ALIVE: 300
> > ACCEPT-CHARSET: Big5,utf-8;q=0.7,*;q=0.7
>
> [...]
>
> > This is a request example.
>
> > [Thu Jan 17 15:42:47 2008] [error] '\\xe4\\xb8\\xad\\xe6\\x96\\x87'
>
> > This is the title non-decoded string I print in application
> > print repr(Kwargs['modify_title'])
>
> > Not only this example. Every params seems did not be decoded.
>
> > On 1月17日, 下午2時31分, "Florent Aide" <[EMAIL PROTECTED]> wrote:
>
> I verified and the filter is correctly doing its job (decoding the
> params to unicode objects).
> _But_ what we receive in the controller is an utf-8 encoded string and
> not the expected unicode object. This means something else as
> re-encoded the params to utf-8.
>
> This is the same comportment I get with CP 2.2.1. For the moment,
> consider all the strings to be utf-8 encoded, I'll look into why we
> don't receive the expected unicode object tonight.
>
> Cheers,
> Florent.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---