Posted By:
Manish_Singh
Posted On:
Wednesday, December 12, 2001 10:41 PM
i have a problem i have a html form set to utf-8 and with two parameters one "name" and the other is a hidden input type "charset" with value utf-8. i pass these values to jsp. which reads the name and charset and write it down onto a file the code i have used is here:- string text = req.getparameter("name"); StringBufferInputStream sb=new StringBufferInputStream( text); InputStreamReader irs=new InputStreamReader(sb, charset); BufferedReader in=new BufferedReader(irs); FileOutputStream fos=new FileOutputStream(new File("frm2.txt")); OutputStreamWriter osw=new OutputStreamWriter(fos, charset); Buffer
More>>
i have a problem
i have a html form set to utf-8 and with two parameters one "name" and the other is a hidden input type "charset" with value utf-8. i pass these values to jsp. which reads the name and charset and write it down onto a file the code i have used is here:-
string text = req.getparameter("name");
StringBufferInputStream sb=new StringBufferInputStream( text);
InputStreamReader irs=new InputStreamReader(sb, charset);
BufferedReader in=new BufferedReader(irs);
FileOutputStream fos=new FileOutputStream(new File("frm2.txt"));
OutputStreamWriter osw=new OutputStreamWriter(fos, charset);
BufferedWriter bw=new BufferedWriter(osw);
//loop to write to a file
int len=800;
char buf[]=new char[len];
int numRead;
while((numRead=in.read(buf))!=-1);
bw.write(buf);
bw.close();
in.close();
out.println("File created successfully");
as you see i have mentioned charset as my encodeing everywhere. but whwn i run this code it shows me an exception called MalformedIOexception. can you helpme?
i want to keep everything utf-8 so as to support other languages also
please help me i want to have multilingual file!!!!!
<<Less