Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Extracting Japanese(kana) Charecters from a file  RSS feed

 
mou haj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody help me??
I have a csv file or a fixed length txt file from where I'll have to capture some Kana Information and store them in a Database and also display them on a browser Im trying with this code but cant do it its displaying some junk
**************************
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.* ;
import java.lang.*;
import java.util.*;
public class showFile3 extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doPost(req,res);
}//end of doGet
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}//end of init
public void doPost (
HttpServletRequest request,
HttpServletResponse response
) throws ServletException, IOException
{
PrintWriter out = new java.io.PrintWriter(response.getOutputStream ());
int i;
String str;
String encodingType = "JISAutoDetect";
try{
RandomAccessFile jpTextFile = new RandomAccessFile("d:\\filehandling\\kana.txt", "r");
byte[] fileBytes = new byte[20] ;
String fileString = null;
jpTextFile.read(fileBytes, 0, 15) ;
fileString = new String(fileBytes, encodingType);
System.out.println(fileString);
out.println("<html><head>");
out.println(" <META HTTP-EQUIV='Content-Type' Content='text/html; charset=x-sjis'></head><body>");
out.println(""+fileString+"");
out.println("</body></html>");
out.close();
}
catch (Exception e)
{
System.err.println("File input error");
}
}//post ends
}//class ends
**************************************
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!