Hi all

I am sure this has been talked about many times and answers available but I have spent quite a bit of time trying to solve a problem that I have with encoding.

I am trying to interact with the Google Maps API and just need to send a HTTP request.

All works except for when I try and use any words like düsseldorf do I run into problems as the ü is converted to \127 in the HTTP request.

I have tried a GET request to see what the query string in browser looks like and it is fine - this happens after I collect the form input and try to send it to google using java.net.URLConnection code.

I have meta tag on the page:

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

I have in the Application Class:

         public Application() {
        super();
com.webobjects.appserver._private.WOURLEncoder.WO_URL_ENCODING = "UTF8";

}

        public void appendToResponse(WOResponse r, WOContext c){

        r.setDefaultURLEncoding("UTF-8");
// r.setHeader("text/html; charset=UTF-8; encoding=UTF-8", "content-type");

if (_NSUtilities.UTF8StringEncoding.equals(r.contentEncoding ()))
                        r.setHeader("text/html; charset=UTF-8", "content-type");
           super.appendToResponse(r, c);
   }

And even:

public WOResponse createResponseInContext(WOContext wocontext) {
                WOResponse woresponse = 
super.createResponseInContext(wocontext);
                woresponse.setContentEncoding(_NSUtilities.UTF8StringEncoding);
                return woresponse;
        }


This is Session Class:

            public void appendToResponse(WOResponse r, WOContext c){
          //   r.setContentEncoding("UTF8");
            r.setDefaultURLEncoding("UTF-8");
            WOResponse.setDefaultURLEncoding("UTF-8");
// r.setHeader("text/html; charset=UTF-8; encoding=UTF-8", "content-type");
            super.appendToResponse(r, c);
        }
public void takeValuesFromRequest(WORequest aRequest, WOContext aContext) { aRequest.setDefaultFormValueEncoding (_NSUtilities.UTF8StringEncoding );
     super.takeValuesFromRequest(aRequest, aContext);
    }

And this is the Parent and child components on the page:

public void takeValuesFromRequest(WORequest aRequest, WOContext aContext) { aRequest.setDefaultFormValueEncoding (_NSUtilities.UTF8StringEncoding );
     super.takeValuesFromRequest(aRequest, aContext);
    }





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to