As I suspected, if I check the used encoding in wsgi I get:
ANSI_X3.4-1968

I found you can define the coding of the script with a special comment: # -*- coding: utf-8 -*-

Now I don't get an error but my special chars still doesn't display well.
The script:
# -*- coding: utf-8 -*-
import sys
def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World! é ü à ũ'
    #output = sys.getfilesystemencoding() #1

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

Gives in the browser as output:

Hello World! é ü à ũ

And if I check the encoding with the python script (uncommenting line #1), I still get ANSI_X3.4-1968

This is really getting on my nerves.


Op 17-08-14 om 13:04 schreef Peter Otten:
Dominique Ramaekers wrote:

Putting the lines in my apache config:
AddDefaultCharset UTF-8
SetEnv PYTHONIOENCODING utf-8

Cleared my brower-cache... No change.....
Did you restart the apache?



--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to