Re: sending a url with international characters
Re: sending a url with international characters
- Subject: Re: sending a url with international characters
- From: Pierre Frisch <email@hidden>
- Date: Tue, 16 Dec 2003 09:42:09 -0800
Hi Gino,
Let me shed some light on that issue.
When you submit D\374sseldorf to the database it does not find it
because | is not properly encoded in UTF8.
There is W3C recommendation on how to encode URL with non ASCII
characters and it is quite easy to follow now as Java 1.4.1 implements
reliably the encode and decode functions. Unfortunately WO has not been
updated to support this transparently (sight). There is some support
that has been added for encoding URL in UTF8 in particular if you query
string (after the ?) include WOURLEncoding=UTF8 the values will be
properly decoded as UTF8 and the subsequent DB query will work. The
trick is how do to it reliably on the encoding side.
You must set WOResponse.setDefaultURLEncoding("UTF-8") before the first
appendToResponse() i.e. in the session.appendToResponse() before the
super.appendToResponse() and you must add the binding
WOURLEncoding=UTF8 to your WOHyperLinks. You may be able to just add
?WOURLEncoding=UTF8 I have never tried it I have a component that wrap
my hyperlinks and force the value in the query dictionary to be sure
never to forget it. Check your source code you should see the non ASCII
characters encoded as %xx%xx and every hyper link should have
WOURLEncoding=UTF8 in the query string.
The rest should work by itself.
Pierre
On Dec 16, 2003, at 8:55, Gino Pacitti wrote:
> Hi Pierre
>
> Let me explain the situation a little more.
>
> The URL is bound to a direct action and I have added a couple or
> bindings.
>
>
>
> One of them is:
>
> ?item = "D|sseldorf"
>
> I have this in the Application Construtor -
> WORequest.setDefaultURLEncoding("UTF-8");
>
> The web page is set to encoding - UTF-8
> The dictionary for the model has the encoding set to UTF-8 as well
>
> When I pull the value that was submitted I see this - "this is the
> title D\374sseldorf"
> which is a System.out.println of the String title =
> (String)this.request().formValueForKey("item");
>
> And this is the resulting sql statement to retrieve the record
> <com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT
> t0.itemID, t0.employer, t0.prePositionOverview, t0.jobName FROM tItem
> t0 WHERE t0.location like ? ESCAPE '|' ORDER BY t0.jobName ASC"
> withBindings: 1:"D\374sseldorf%"(location)>
>
>
> Is this correct?
>
> Why cant I get the record which is stored?
> Best
>
> Gino
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.