On Tue, 2004-10-26 at 13:39 +0900, Shawn wrote:
>  > I have been testing the new jdbforms 2.5 snapshot in tomcat 5.0.28 for a
> > while,
> > Tomcat 5.0.28 implement a different way to treat utf-8 encoding.
> > 
> > dbforms are prepared to handle this, but when multipart attribute is set to
> > true all the other text fields in the form are update with error encoding.
> 
> Ah ha! You tracked it down.  I don't use multipart attribute and that is
> why I never saw the problem and why some of your pages worked while
> others did not.
> 
> I do not know the solution but what is happening is that there is this
> in DbFormTag:
> 
> if (hasMultipartSet()) {
>       tagBuf.append(" enctype=\"multipart/form-data\"");
>                               }
> 

Someone else may have a better idea, but I suggest looking at
org.dbforms.util.MultipartRequest.java

What happens if you add  request.setCharacterEncoding("UTF-8"); to:

 public MultipartRequest(HttpServletRequest request, int maxPostSize)
                        throws IOException {

//you could try setting it again here
request.setCharacterEncoding ("UTF-8");
//of course it may get ignored like in the filter

Otherwise, what about trying this patched method (no guarantees I have
not tested this):

public String[] getParameterValues(String name) {
                try {
                        Vector values = (Vector) parameters.get(name);

                        if ((values == null) || (values.size() == 0)) {
                                return null;
                        }

                        String[] valuesArray = new String[values.size()];
                        values.copyInto(valuesArray);
//patch starts here
            for (int i=0;i<valuesArray.length;i++){
                valuesArray[i]=new String(valuesArray[i].getBytes
("UTF-8"));
            }
//patch ends here
                        return valuesArray;
                } catch (Exception e) {
                        return null;
                }
        }

*IF* the patched method works for you, we could think about how to pass
in the encoding as a parameter so it wouldn't be hardcoded to UTF-8
-- 
Shawn <[EMAIL PROTECTED]>



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to