Form fields with file upload (in one form )doen't support unicode(other than default english)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Form fields with file upload (in one form )doen't support unicode(other than default english)

navid shakooian
Hi gentlemen,

I'm trying to upload a file with some other text
fields that are in a form.But because characters I use
are in Persian (not in default english codepage) after
form fileds being parsed by upload.parseRequest() and
when I try to get form fields and values using
item.getFormField() and item.getString() I only have
garbages for values .
Could you please help me how I can add unicode support
to DiskFile upload and solve this problem?
Thanks all

Navid Shakooian


///////////////////////////////////////////
        try {
            request.setCharacterEncoding("UTF-8");
            upload = new DiskFileUpload();
            upload.setHeaderEncoding("UTF-8");
            Msg = upload.getHeaderEncoding();
            upload.setHeaderEncoding("UTF-8");


// Parse the request
            List items;
//                items =
upload.parseRequest(request,1024,100000,"//home//gomroku1//www//IMAGES//AKHBARS//tmp");
            items = upload.parseRequest(request, 1024,
100000, "e://gomroku1");


            Iterator iter = items.iterator();



            while (iter.hasNext()) {
                FileItem item = (FileItem)
iter.next();

                if (item.isFormField()) {
                    //form fields

                    String name = item.getFieldName();
---->>>>invalid characters))))   String value =
item.getString();
                    if( value == null) value="";
     
                } else {
                    //upload fields
                    String fieldName =
item.getFieldName();
                    String fileName = item.getName();
                    File   extractfile = new
java.io.File(fileName);
                    fileName = extractfile.getName();
                    if( fileName == null)
fileName="";
                    String contentType =
item.getContentType();
                    boolean isInMemory =
item.isInMemory();
                    long sizeInBytes = item.getSize();









               
____________________________________________________
Sell on Yahoo! Auctions ? no fees. Bid on great items.  
http://auctions.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]