473,396 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Character Encoding problem

Hello,
I want to read text from text area of jsp page and write its contents to a text file which is at server side.While doing this contents are get written into the file at server side file but its encoding get changed to another form. My text area contains some marathi text. english text gets written properly.Problem is only for marathi text.
I am using tomcat4.1.
Following is my code ...
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<%@page import="java.io.*"%>
<%@ page import="java.net.URL" %>
<%
//String strName = request.getParameter("name");

String msg = request.getParameter("txtaTest");

String func = request.getParameter("func");

System.out.println("func->"+func);
try{
if(func!=null){
String strPath = "/home/ignu/dineshCpp/tomcat/apache-tomcat-4.1.34-LE-jdk14/temp/outFile1.txt";
File strFile = new File(strPath);
Writer objWriter = new BufferedWriter(new FileWriter(strFile));
// objWriter.write(strName );
objWriter.write("\n");
objWriter.write(msg );
objWriter.write("\n");
objWriter.flush();
objWriter.close();
}
}catch(Exception e){}
%>
<body>
<b>**********************INPUT FILE SAVED****************
<P>
<b>TO DOWNLOAD FILE CLICK HERE:-
</body>
</html>
Jul 16 '07 #1
1 1799
praveen2gupta
201 100+
Hi

Your Page encoing is correct. Your problem is with marathi characters It means
you will be facing problems with other indian language characters. Your problem may be following.

1. you have applied utf-8 encoding but it may not be effective. Open your page from the server in IE and see the view->encoding what it is showing. Dont change it. It should be at utf-8.

2.If step one is correct then your server encoding may be different. set your
Tomcat server encoding to utf-8.

Check it and post the results.
Jul 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Safalra | last post by:
The idea here is relatively simple: a java program (I'm using JDK1.4 if that makes a difference) that loads an HTML file, removes invalid characters (or replaces them in the case of common ones...
4
by: HeroOfSpielburg | last post by:
Hello, I am trying to using the Shift_JIS character set in my web pages, and have specified it as such in the <head>. <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> ...
18
by: james | last post by:
Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits the "," and then copies the results into a listbox. The data also...
1
by: PHP Wooer | last post by:
Can anybody there please help me out? I am having a problem with the display of Japanese character in the subject line of the mails sent in Japanese language. This problem is particularly with...
10
by: Paul W | last post by:
Hi all, I have an application that reads data in from a text file and stores it in a database. My problem is that there are some characters in the file that aren't being handled properly. For...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.