I use Python 3.2.5 and Oracle Linux 6.4. I have written my wsgi 
application but I have some trouble: function urllib.parse.parse_qs behave 
differently depending on the way I started my application (Apache with 
mod_wsgi 4.2.6 or wsgiref.simple_server). In my application function I have 
the following code:

def application(environ, start_response):
    print(environ["QUERY_STRING"])
    requestParams = parse_qs(environ["QUERY_STRING"])
    print(requestParams)
    .......

  When I start my program using wsgiref.simple_server and make a query 
/query?name=Иван (it's Russian name) I get the following output:

name=%D0%98%D0%B2%D0%B0%D0%BD{'name':['Иван']}

But my application with Apache + mod_wsgi 4.2.6 gives me the following: 

name=%D0%98%D0%B2%D0%B0%D0%BD{'name':['\xd0\x98\xd0\xb2\xd0\xb0\xd0\xbd']}

As you can see, the latter doesn't give me correct Russian word encoded in 
UTF-8 although the input to the function is the same. According to 
https://docs.python.org/3.2/library/urllib.parse.html function parse_qs has 
default parameter encoding='utf-8'. As a result I have other problems 
during further work. I can't understand why this function works 
differently. But it seems that mod_wsgi affects on this behavior (as soon 
as when I do sudo -u apache python3.2 my_project.py everything works well). 

I have the following Apache virtual host:

<VirtualHost *:80>
    DocumentRoot /var/www/my_project
    <Directory />
         Options FollowSymLinks
         AllowOverride None
     </Directory>
     <Directory /var/www/my_project/>
           Options Indexes FollowSymLinks MultiViews
           AllowOverride None
          Order allow,deny
         allow from all
      </Directory>
      WSGIDaemonProcess my_project processes=8 threads=1 
python-path=/var/www/my_project display-name=%{GROUP} 
      WSGIProcessGroup my_project
      WSGIScriptAlias /my_project /var/www/my_project/my_project.py
</VirtualHost>

 My apache uses prefork MPM.

I also tried to use lang=en_US.UTF-8 locale=en_US.UTF-8 in WSGIDaemonProcess 
directive, but it didn't help.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to