UTF-8 Encoding questions for formValues() for non WO html fields
UTF-8 Encoding questions for formValues() for non WO html fields
- Subject: UTF-8 Encoding questions for formValues() for non WO html fields
- From: Helmut Tschemernjak <email@hidden>
- Date: Tue, 22 Jun 2004 09:42:59 +0200
- Organization: HELIOS Software GmbH
Hello,
I am including private HTML in a Component, the HTML is included via a
WOString. E.g.: the WOString looks like this:
"<input size=\"32\" maxlength=\"32\" type=text name=\"testname\">"
"<input type=submit value=\"Burn CD\" name=\"doOK1\">";
Now I like to pull the value from this private HTML field within my
Component takeValuesFromRequest function using aRequest.formValues()
function. In general it works. The problem is:
If the field includes special characters e.g. umlauts it is not UTF-8
encoded. I traced it via "ethereal" and the HTTP response includes the
"testname" field content in UTF-8, but somehow I don't get UTF8 using
stringFormValueForKey("testname") or formValues();
The binding using WO HTML with the WOD file works fine and provides
UTF-8 fields.
Why am i doing this strange HTML inclusion. We have an app with custom
action scripts behind to be developed by others. The output of this
scripts gets included in the Component content. This allows a kind a
tiny CGI within the Component. The CGI back end is a perl script
generating the HTML, and getting called again with all non WOD handled
Component form fields which we get via aRequest.formValues()
Any ideas why the encoding of formValues() is not utf8?
Thanks
Helmut Tschemernjak
-------
PS: I am setting up the UTF-8 in the Application class see code below:
=====================================
public void appendToResponse(WOResponse aResponse, WOContext aContext) {
aResponse.setContentEncoding("UTF8");
aResponse.setDefaultEncoding("UTF8");
aResponse.setHeader("text/html; charset=UTF-8; encoding=UTF-8",
"content-type");
super.appendToResponse(aResponse, aContext);
}
public void takeValuesFromRequest(WORequest aRequest, WOContext aContext) {
aRequest.setFormValueEncodingDetectionEnabled(false);
aRequest.setDefaultFormValueEncoding("UTF8");
super.takeValuesFromRequest(aRequest, aContext);
}
_______________________________________________
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.