Hi Manuel, It seems that you would be really helped by learning more about unicode and utf-8. I think this is a great introduction to it.
http://www.joelonsoftware.com/articles/Unicode.html Remember, in UTF-8 encoding, most non-english characters will take 2 or more bytes to represent during transport or storage. This is why your last character was missing, because mod_wsgi was given the number of characters, not bytes... Since you only had one multi-byte character (in UTF-8), only one went missing. Suggest you try a WSGI framework like Bottle, Flask, AppStruct, etc... which insulates you from many of these arcane details. Take care, JG On Thu, Oct 6, 2011 at 5:29 PM, Manuel Antonio Mora Sandoval < [email protected]> wrote: > Yes, thank you, Excuse me fot this dumb question, I don't know what happen. > > Thank you very much. > > > 2011/10/6 Deron Meranda <[email protected]> > >> On Thu, Oct 6, 2011 at 11:33 AM, Manuel Antonio Mora Sandoval >> <[email protected]> wrote: >> > 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')] >> >> >> The HTTP Content-Length specifies size in units of bytes. >> >> However the python len(output) returns the value in number of characters. >> >> Try setting content length to len(output.encode('utf-8')) >> >> -- >> Deron Meranda >> http://deron.meranda.us/ >> >> -- >> 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. > -- 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.
