• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

junk characters in netui:form with enctype="multipart/form-data"

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all

I have a JSP that goes like this:



In others JSPs within the same app (each document share the same codification tag) I can add data with special characters like ñ, á , ö, ê , etc.
however, in this particular form, they're added to database as junk characters like á , ñ , ...
I've already changed my tables' codification to UTF-8, to no avail

I believe it has something to do with the enctype="multipart/form-data" parameter

Is there anything you can suggest to stop this from happening?
I'm using BEA Weblogic 8.1.3

Thank you in advance
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are the special characters coming from the file ? The encoding problem might not be with the database but with the file itself. Perhaps it was saved with the wrong encoding ?
 
carlos rivera
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no, the problem is the text being inserted in the database, i use the netui:fileupload for uploading an image to the server, and that works just fine.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

carlos rivera wrote:no, the problem is the text being inserted in the database, i use the netui:fileupload for uploading an image to the server, and that works just fine.



You read images with streams and encoding should not be a problem there. Text is a different matter. Does the problem occur when the file is uploaded or when the uploaded contents are inserted into the DB ?
 
carlos rivera
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the problem occurs whether I upload a file or not, everytime I enter 'foreign' characters. When I print the text in console, BEFORE doing the insert to the DB, it's already corrupted. Weblogic is somehow changing the codification of text in this particular Form.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is probably not weblogic's fault. Set the encoding of the JSP page to display. If you are reading this input in some form (instead of having net UI read it automatically), then mention the encoding of the text.

This page http://java.sun.com/j2ee/1.4/docs/tutorial/doc/WebI18N5.html offers some good advice on encoding in its various forms.
 
carlos rivera
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deepak:

Is only when the enctype="multipart/form-data" parameter is removed form the <netui:form> tag, that everything works as expected (I can insert and retrieve accented characters).

I tried the suggestions you gave me, but the characters still change arbitrarily, and every JSP for data input and display are declared to be UTF-8 compliant.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried using commons file upload ? http://commons.apache.org/fileupload/

You should have no problem reading the characters if it is UTF-8 compliant and you use the commons upload API for multipart uploads.
 
The moustache of a titan! The ad of a flea:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic