Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Unicode File movement from Windows to Unix adding Special Characters

Reply
Thread Tools

Unicode File movement from Windows to Unix adding Special Characters

 
 
ragz_82 ragz_82 is offline
Junior Member
Join Date: Apr 2009
Posts: 9
 
      02-08-2011
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
 
Reply With Quote
 
 
 
 
ragz_82 ragz_82 is offline
Junior Member
Join Date: Apr 2009
Posts: 9
 
      02-09-2011
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");
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python unicode utf-8 characters and MySQL unicode utf-8 characters Grzegorz Śliwiński Python 2 01-19-2011 07:31 AM
Remove only special characters and junk characters from a file rvino Perl 0 08-14-2007 07:23 AM
How to display special (unicode) characters =?iso-8859-1?q?J=FCrgen_Gerstacker?= Java 4 05-15-2007 09:02 PM
Special Characters (Unicode, Ascii) in Python and MySQL ronrsr Python 1 01-02-2007 01:43 PM
Re: drawString with special Unicode characters to Graphics object Chris Smith Java 1 05-31-2004 07:33 PM



Advertisments