Hi,
I have a batch program that is used for formatting some data. The
program uses a java class to take an input as a .xls file, formats the
data from that file and converts it into a .csv file.
The issue that I am facing is that some data in the .xls file is not
represented correctly in the .csv file. For example data like "Dékán"
in the .xls sheet is represented like "Dékán" in the formatted file.
I wanted to know how to set the character set to UTF8 in the java
class so that it represents the data correctly even after the
formatting.
Any help would be appreciated.
Regards,
Sandy
RedGrittyBrick - 27 May 2008 13:18 GMT
> Hi,
>
[quoted text clipped - 5 lines]
> represented correctly in the .csv file. For example data like "Dékán"
> in the .xls sheet is represented like "Dékán" in the formatted file.
Maybe the CSV file is correct but you are not loading it or viewing it
with a UTF8 encoding? What does a hex dump of that file reveal?
> I wanted to know how to set the character set to UTF8 in the java
> class so that it represents the data correctly even after the
> formatting.
The API docs for the class will specify how to set the encoding.
e.g. new FileOutputStream("outfilename"), "UTF8");
Since you provide no code I can't identify the appropriate action for
your specific case.
> Any help would be appreciated.
If you read and act on http://sscce.org/ you will get help.

Signature
RGB
Andrew Thompson - 27 May 2008 13:21 GMT
...
> I wanted to know how to set the character set to UTF8 in the java
> class so that it represents the data correctly even after the
> formatting.
You might look to using an..
OutputStreamWriter(OutputStream, java.nio.charset.Charset)
..constructor with an appropriate Charset.
--
Andrew T.
PhySci.org
Sandy80 - 27 May 2008 13:39 GMT
The code that I use to populate the output file is:
out = new BufferedWriter(new FileWriter(surveyFilename));
Roedy Green - 27 May 2008 22:22 GMT
On Tue, 27 May 2008 03:32:12 -0700 (PDT), Sandy80
<svarshneymail@gmail.com> wrote, quoted or indirectly quoted someone
who said :
>The issue that I am facing is that some data in the .xls file is not
>represented correctly in the .csv file. For example data like "Dékán"
>in the .xls sheet is represented like "Dékán" in the formatted file.
you can identify the coding used with an Applet at
http://mindprod.com/jgloss/encoding.html
To read the data with various encodings, see
http://mindprod.com/applet/fileio.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com