The len() of the string is likely 1 less than the len() of the encided bytes because of multibyte characters.
Content-length is expressed in bytes. Take care, JG On Oct 6, 2011 11:33 AM, "Manuel Antonio Mora Sandoval" <[email protected]> wrote: > Hi. > > I have a problem. When I use characters like Ñ, á, é, etc, the navegator > don't shows the last caracters. > > for example, I have the follow code: > > #!/usr/local/bin/python3.2 > # -*- coding: utf-8 -*- > > > def application(environ, start_response): > status = '200 OK' > output = 'Prueba con Ñ1' > > response_headers = [('Content-type', 'text/plain; charset=utf-8'), > ('Content-Length', str(len(output)))] > start_response(status, response_headers) > > return [output.encode('utf-8')] > > I would in the navegator "Prueba con Ñ1", but I get "Prueba con Ñ", without > number 1. > > I reviewed the headers, and these have Content-Length: 13, I think that "Ñ" > occupy two positions and the apache or module cut the string. > > I don't know how do I fixed it? > > thank you for help me. > > -- > You received this message because you are subscribed to the Google Groups "modwsgi" 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/modwsgi?hl=en. > -- You received this message because you are subscribed to the Google Groups "modwsgi" 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/modwsgi?hl=en.
