Re: Http Adaptor and UTF-8 encoded URL [Solved]
Re: Http Adaptor and UTF-8 encoded URL [Solved]
- Subject: Re: Http Adaptor and UTF-8 encoded URL [Solved]
- From: Chuck Hill <email@hidden>
- Date: Fri, 25 May 2007 09:42:57 -0700
I'll bet that one was "fun" to debug! :-( Glad to hear that you
have it working.
Chuck
On May 25, 2007, at 9:40 AM, Alexis Tual wrote:
Okay, with a deployment on another server, it worked... so it had
to be the apache configuration, i compared the http.conf that
worked and the one that didn't and found this differences :
LoadModule encoding_module libexec/httpd/mod_encoding.so
AddModule mod_encoding.c
When this 2 lines are disabled, that works !
I guess with this module enabled, Apache decodes the URL first (Ã%
A9 -> é) as shown in the adaptor logs,
then WO "misinterprets" this "é" in the URL...
Sorry Chuck, for my blurry explanations, the problem itself was
hard to explain :-))
Alexis
Le 24 mai 07 à 23:36, Chuck Hill a écrit :
On May 24, 2007, at 12:33 PM, Alexis Tual wrote:
Le 24 mai 07 à 18:32, Chuck Hill a écrit :
On May 24, 2007, at 5:13 AM, Alexis Tual wrote:
Hello everyone,
i've localized an application, turning all in UTF-8 with the
help of the mighty Practical WO (chapter 8).
All works fine, except the URLs encoded in UTF-8.
I've added the WOURLEncoding=UTF-8 in all my URLs and
WOMessage.setDefaultURLEncoding("UTF8") in Application's
constructor.
This works fine in development but doesn't work in deployment
on an another server.
I found out that in deployment the Http Adaptor decodes (with a
certain charset) directly the parameters whereas in development
mode
the Adaptor just transmits the URL encoded as it receives it
and then WO decodes it right.
For a request "recherche?keyword=cafÃ%
A9&WOURLEncoding=UTF-8", in /tmp/WebObjects.log i get :
Development (Mac OS X - WO 5.3.3) :
Request GET /cgi-bin/WebObjects/MyApp.woa/-50267/wa/recherche?
keyword=café&WOURLEncoding=UTF-8
Notice how the value "café" is still encoded café
Development means Direct Connect, not going through Apache?
It means : app launched with WOLips and still going through
Apache (it works indeed with DirectConnect)
I am not quite following. What does the complete URL in the
browser look like? I would expect café to be the _wrong_ value.
For the record :
Complete URL in Firefox : http://mydomain.com/cgi-bin/WebObjects/
MyApp.woa/wa/recherche?keyword=café&WOURLEncoding=UTF-8
In dev mode
URL in Adaptor logs : /cgi-bin/WebObjects/MyApp.woa/wa/recherche?
keyword=café&WOURLEncoding=UTF-8
request().uri() in recherche DA : /cgi-bin/WebObjects/MyApp.woa/wa/
recherche?keyword=café&WOURLEncoding=UTF-8
In deployment
URL in Adaptor logs : /cgi-bin/WebObjects/MyApp.woa/wa/recherche?
keyword=cafeÃ&WOURLEncoding=UTF-8
request().uri() in recherche DA : /cgi-bin/WebObjects/MyApp.woa/wa/
recherche?keyword=cafeÃ&WOURLEncoding=UTF-8
Deployment (Mac OS X Server - WO 5.3.3) :
Request GET /cgi-bin/WebObjects/MyApp.woa/1/wa/recherche?
keyword=cafeÌ&WOURLEncoding=UTF-8
Notice how the value "café" is decoded from café with a
certain charset
Are you sure that output is not just an artifact of the
logging. I have seen strings get "misinterpreted" by the
logging functions before. The value is correct, it is just
output incorrectly in the log message.
Still in deployment mode, when i do stringFormValueForKey
("keyword") in my DirectAction i don't get the right string.
But how do you _see_ the string? Do not trust NSLog.
It seems the Adaptor decodes the URL and then passes it to the WO
app. Is this the correct behaviour ?
... or maybe i'm missing something.
IIRC the WO frameworks decode it before calling dispatchRequest.
I suspect that you are getting the _wrong_ value in development
and the right one in deployment, but that NSLog is just displaying
the right value incorrectly. IIRC, you should not need to
URLDecode the form values yourself.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden