On Mon, Sep 8, 2008 at 5:41 PM, Anand Chitipothu <[EMAIL PROTECTED]> wrote:
>
>> I found 'result' must convert to a unicode obj here.
>
> No. There is no need like that.
> If the result is unicode, then it is converted to utf-8. If it is a
> regular string, then it is not altered.
>
Yes. result should be converted to string at last.

>> If I remove
>> utils.utf8() here. My chinese-utf8 template will output a blank page
>> without content.
>
> Is there any change that you are doing print instead of return?
utils.utf8(result) will convert  <TemplateResult: {'__body__':
u'<!DOCTYPE html PUBLIC...>
to a regular string : '<!DOCTYPE html PUBLIC ...>'

>> If you want return a raw-binary data to browser, such as a CAPTCHA
>> image, you should try 'yield' . I found it will skip string/unicode...
>> validator.
>>
>> Anand, Is 'yield' the official way to handle raw-binary data?
>
> No. In fact, it is a bug and needs to be fixed.

I need a way to display captcha image.
If I return raw-binary, utils.utf8() try to decode it and fail.
If I yield raw-binary, browser show correct image, but webpy skip
session-saving. I guess it's ano

Anyway, 'yield' is very useful. For example, downloading a big
attachment in a webmail system.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to