Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

International Characters and Java



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@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.