• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOFileUpload with UTF-8 forms
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOFileUpload with UTF-8 forms


  • Subject: Re: WOFileUpload with UTF-8 forms
  • From: Helmut Schottmüller <email@hidden>
  • Date: Wed, 17 Jan 2007 15:40:50 +0100

I seems that there is one more pitfall. When I tested my WOFileUpload script on another computer, it had some strange behaviour. The data and filePath bindings have not been stored after form submissions. The data binding was filled with an empty NSData object instead of null when nothing was selected...
I got this working correctly when I added

- WOUseLegacyMultipartParser true

as launch parameter.

Regards,

Helmut

Am 16.01.2007 um 10:38 schrieb Helmut Schottmüller:

Hi Matt,

you can find a solution in an older posting of Chuck Hill (http://www.wodeveloper.com/omniLists/webobjects-dev/2003/September/msg00455.html).
In short:

1. overwrite takeValuesFromRequest in your multipart form component:

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

2. overwrite the createRequest method in Application

public WORequest createRequest(String aMethod, String aURL,
String anHTTPVersion, NSDictionary someHeaders, NSData aContent,
NSDictionary someInfo)
{
WORequest newRequest = super.createRequest(aMethod, aURL, anHTTPVersion,
someHeaders, aContent, someInfo);
newRequest.setDefaultFormValueEncoding(_NSUtilities.UTF8StringEncoding);
return newRequest;
}

he also used the following overwrite in Application:

public WOResponse dispatchRequest(WORequest request)
{
WOResponse response = super.dispatchRequest(request);

String contentType = response.headerForKey("content-type");
if ((contentType == null) || (contentType.toLowerCase().indexOf("text/html") > -1))
{
response.setContentEncoding(_NSUtilities.UTF8StringEncoding);
response.setHeader("text/html; charset=UTF-8; encoding=UTF-8", "content-type");
}
return response;
}

This should do it. It works fine in my projects.
For more detailed information, please refer to Chucks original post.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >WOFileUpload with UTF-8 forms (From: "Matt Kime" <email@hidden>)
 >Re: WOFileUpload with UTF-8 forms (From: Helmut Schottmüller <email@hidden>)

  • Prev by Date: So little time, so many mistakes to be made...
  • Next by Date: Perform Parent Action from within a WORepetition in the subcomponent
  • Previous by thread: Re: WOFileUpload with UTF-8 forms
  • Next by thread: D2WEditToOneRelationShip java.lang.IllegalArgumentException
  • Index(es):
    • Date
    • Thread