spoj
asked on
CSV and Multilingual Characters Problem
Hi, i am trying to write a program that creates an xml and a csv file, given a set of data.... i have no problem displaying the contents of the xml that i have written, the problem is my csv file.... microsoft excel 2000 could not open the file properly, it only displays garbage in the place of the multilingual characters... i have installed a language pack for my operating system (Win2K advanced server)....
below is my code for writing the data:
*** xml writer *****
import java.io.*;
public class XMLWrite {
public static void main(String[] args) {
try {
BufferedWriter bw =
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream("C:\\test \\test.xml "), "UTF8"));
bw.write("<data>");
bw.newLine();
bw.write("<line>" + "\u1116\u1126\u1136\u1146" + "</line>");
bw.newLine();
bw.write("<line>" + "\u1146\u1126\u1136\u1116" + "</line>");
bw.newLine();
bw.write("</data>");
bw.newLine();
bw.flush();
bw.close();
}
catch (Exception ex) {
}
}
}
*** csv writer *****
package experiment;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2003
* Company:
* @author
* @version 1.0
*/
import java.io.*;
public class Write {
/**
*
*/
public static void main(String[] args) {
try {
BufferedWriter bw =
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream("C:\\test \\test.csv "), "UTF8"));
bw.write("1,1,\u1116\u1126 \u1136\u11 46");
bw.newLine();
bw.write("2,2,\u1116\u1126 \u1136\u11 46");
bw.newLine();
bw.flush();
bw.close();
}
catch (Exception ex) {
}
}
}
below is my code for writing the data:
*** xml writer *****
import java.io.*;
public class XMLWrite {
public static void main(String[] args) {
try {
BufferedWriter bw =
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream("C:\\test
bw.write("<data>");
bw.newLine();
bw.write("<line>" + "\u1116\u1126\u1136\u1146"
bw.newLine();
bw.write("<line>" + "\u1146\u1126\u1136\u1116"
bw.newLine();
bw.write("</data>");
bw.newLine();
bw.flush();
bw.close();
}
catch (Exception ex) {
}
}
}
*** csv writer *****
package experiment;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2003
* Company:
* @author
* @version 1.0
*/
import java.io.*;
public class Write {
/**
*
*/
public static void main(String[] args) {
try {
BufferedWriter bw =
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream("C:\\test
bw.write("1,1,\u1116\u1126
bw.newLine();
bw.write("2,2,\u1116\u1126
bw.newLine();
bw.flush();
bw.close();
}
catch (Exception ex) {
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.