Unicode Text Fileupload using MultipartRequest Failing

Joined
Apr 8, 2009
Messages
9
Reaction score
0
Hi,
I am working on an existing application which allows the user to submit a CSV file for upload. Post submit, the servlet uses MultipartRequest API to transfer the file to a location on the Unix server. Then an Oracle St Proc is called which traverses this file and inserts each row into a table.

Recently there was a change-request to support German and Japanese characters in the CSV file for upload. As CSV won't support these chars, the file was saved as "Unicode Text" type and below JAVA changes were made:

MultipartRequest multi = new MultipartRequest(request, "/tmp", 20000000, "UTF-8"); // UTF-8 was introduced to support the Unicode File type. This parameter was not used for CSV files before.

The file is being transferred to the destination, but the foreign chars and the regular chars are distorted with addition of unwanted chars. This was verified by doing a "vi" and "cat" in Unix. If this file is transferred back to Windows using WinSCP, the file looks ok. Also, the Oracle PL/SQ code is failing because of this distortion.

Hence below are my questions. Feel free to answer whatever you are aware of:
1. Can MultipartRequest support Unicode text files?
2. If yes, then do I have to modify the parameters in the above JAVA call?
3. Is there specific requirements on the Oracle side to handle such files? Below are the highlights of the current Oracle code.

f_handle UTL_FILE.FILE_TYPE;
v_linebuffer nVARCHAR2(1000);
f_handle := UTL_FILE.fopen_nchar('TMP_DIR',p_filename,'R');
UTL_FILE.GET_LINE_nchar(f_handle, v_linebuffer);

Personally, I feel that this is a complex approach and could have been simplified by allowing JAVA to handle the data and make insert requests to Oracle. But before making such design changes, I want to rule out any possible encoding/setting related fixes.

Any suggestions are appreciated.

Thanks,
Raghu
 

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top