Unicode File movement from Windows to Unix adding Special Characters


Joined
Apr 8, 2009
Messages
9
Reaction score
0
Hi,
In our application a Unicode file with German and Japanese characters is submitted, which is moved to a Unix directory by using the MultipartRequest JAVA API. Later Oracle PL/SQL processes the file and makes entries in the database.

We have observed that this load is failing since the file is having some special characters when it is getting transferred to Unix. The file is untouched if it contains only English characters. To confirm this we created a file directly in Unix containing Ger/Jap chars and called the Oracle St Proc and it worked fine. When this same file was moved back to Windows using WinSCP, the file was different again.

Hence overall it looks like Unicode file movement between Windows and Unix changes the file in someway for some reason. Please let me know if any JAVA API can avoid this issue.

I scanned the Net for close to a week but couldn't find anything related. Any help will be greatly appreciated.

If we cant find any solution, we are considering using POI so that JAVA can directly update the Database.

Rgds,
Raghu
 
Ad

Advertisements

Joined
Apr 8, 2009
Messages
9
Reaction score
0
I read that MultipartRequest and Apache FileUpload are the two common APIs used to perform file uploads in JAVA. Hence I tried also with the Apache API, but the result was exactly the same.

Hence I suspect that some encoding related setting is missing in either the JSP or the Servlet code. Below is my code snippet. Please suggest.

-- JSP
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">
<meta http-equiv="Cache-Control" content="no-cache">

<script language="javascript" src="../js/stylesheet.js"></script>
<script language="JavaScript" src="../js/datePicker.js"></script>
<script language="JavaScript" src="../js/validate.js"></script>

</head>

<body>

<form ENCTYPE="multipart/form-data" name="frmUpload" method="POST" action="<%= request.getContextPath() %>/servlet/TestServlet">

Select File: <input type="file" name="file" size="30">
<input value="Upload" name="cmdUpload" type="submit">

-- Servlet
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
request.setCharacterEncoding("UTF-8");

MultipartRequest multi = new MultipartRequest(request,
"/tmp",
20000000,
"UTF-8");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top