Home
Analytics
Encoding of CSVRenderOption
Miss_Anonymus
<p>Hello community,</p>
<p> </p>
<p>I'm using the CSVRenderOption PlugIn to create CSV Reports. The content comes out fine, but when I open the file with MS Excel there are special letters like ä ö ü ß and so on missing. So, the encoding is not right. When I open the file with an normal text editor, the special letters are therem, no problems. Just with excel. What can I do?</p>
<pre class="_prettyXprint _lang-">
public File processingCSV() throws BirtAgentException
{
IRunAndRenderTask task = createTask();
String tempFile = System.getProperty("java.io.tmpdir") + "temp.csv";
CSVRenderOption csvOptions = new CSVRenderOption();
csvOptions.setOutputFormat(CSVRenderOption.OUTPUT_FORMAT_CSV);
csvOptions.setExportTableByName("table");
csvOptions.setOutputFileName(tempFile);
csvOptions.setDelimiter(";");
task.setRenderOption(csvOptions);
task.setEmitterID("org.eclipse.birt.report.engine.emitter.csv");
try
{
task.run();
}
catch (EngineException e)
{
e.printStackTrace();
}
task.close();
return new File(tempFile);
}
</pre>
<p>There I generate the file, an here I open it (the standard programm is excel):</p>
<pre class="_prettyXprint _lang-">
....
try
{
Desktop.getDesktop().open(new File(tempFile));
}
catch (Exception e)
{
.....
</pre>
<p>What can I do? Where can I set the encoding and which one should it be? </p>
<p> </p>
<p>Thanks!</p>
<p> </p>
Find more posts tagged with
Comments
JFreeman
<p>Could you confirm the version of the CSV emitter plugin and BIRT Designer you are utilizing?</p>
Matthew L.
<p>Adding to Jesse's post, what characters are causing the output issue for the encoding type?</p>
<p> </p>
<p>If you are using the emitter found in the link below, I believe it outputs to UTF-8 encoding only at the moment, however you can ask the developer of the emitter for more details on the encoding options.</p>
<p>CSV emitter: <a data-ipb='nomediaparse' href='
http://code.google.com/a/eclipselabs.org/p/csv-emitter-birt-plugin/'>http://code.google.com/a/eclipselabs.org/p/csv-emitter-birt-plugin/</a></p>
;
Miss_Anonymus
<p>I'm using the <a data-ipb='nomediaparse' href='
http://code.google.com/a/eclipselabs.org/p/csv-emitter-birt-plugin/downloads/detail?name=org.eclipse.birt.report.engine.emitter.csv_1.0.0.201110121016.jar&can=2&q='>org.eclipse.birt.report.engine.emitter.csv_1.0.0.201110121016.jar</a> (exactly
from the link above) and the 4.4 BIRT version. The deficient output arises with the special characters like "Ä", "Ö", "ß" etc...</p>
JFreeman
<p>Looking through the source code for the project I see that the CSVWriter is being set with UTF-8 encoding:</p>
<pre class="_prettyXprint _lang-js _linenums:135">
writer.open( out, "UTF-8" );
</pre>
<p>Doing a quick spot check, I can see that the characters you have specified do appear to have valid encoding in UTF-8.</p>
<p> </p>
<p>I setup a test using this emitter and received an interesting result. I added a column to a table with the characters "ä ö ü ß" in the details row. When exported to CSV, the first pages content shows the characters properly, however on all subsequent pages content the characters are missing. This indicates the issue isn't explicitly due to the encoding but something with how the emitter is processing the content.</p>
<p> </p>
<p>I would recommend contacting the owner/creator of the project.</p>
<p> </p>
<p>Alternatively, the <a data-ipb='nomediaparse' href='
https://code.google.com/a/eclipselabs.org/p/csv-emitter-birt-plugin/source'>source
code</a> for the project is available for you to make your own modifications.</p>