Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
    Bookmark Topic Watch Topic
  • New Topic

JSP and HTML Encoding

Dharamvir (DV) Punia
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have a jsp which uploads a file through a servlet, in Servlet when I
read the filename, its encoded. e.g
- original file name passed in jsp - dv_test.dec
- when i read in servlet after being submitted from jsp, the
name i get is dv_test.doc

So what's happending is "underscore" in filename is replaced with "_"

Below is what is in jsp header, I have tried without it still the same.
<%@ page
contentType="text/html; charset=UTF-8"
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">

The only thing I am doing different in JSP is setting the "enctype" in
form tag as shown below:
<form name="fileUploadForm2"
action="/FileUploaderDB2/DB2FileUploaderServlet" method="post"

Can someone tell me why this is happening and how it can be avoide.

Bear Bibeault
Author and ninkuma
Posts: 65278
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Dharamvir, please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please continue any discussion of this topic here.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic