From 7cf96275a244665a576e1be1bf756c03e74237cd Mon Sep 17 00:00:00 2001 From: hieplq Date: Tue, 26 Nov 2013 19:22:42 -0500 Subject: [PATCH] IDEMPIERE-1213 set encoding when export grid to file --- .../src/org/adempiere/impexp/GridTabCSVExporter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java index cbb4cb39ea..6fa6c2e42c 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java @@ -16,9 +16,11 @@ package org.adempiere.impexp; import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE; +import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStreamWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; @@ -47,6 +49,7 @@ import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Evaluator; +import org.compiere.util.Ini; import org.compiere.util.Msg; import org.compiere.util.Util; import org.supercsv.cellprocessor.FmtBool; @@ -76,7 +79,10 @@ public class GridTabCSVExporter implements IGridTabExporter MTable table= null; MTable tableDetail = null; try { - mapWriter = new CsvMapWriter(new FileWriter(file), CsvPreference.STANDARD_PREFERENCE); + FileOutputStream fileOut = new FileOutputStream (file); + OutputStreamWriter oStrW = new OutputStreamWriter(fileOut, Ini.getCharset()); + BufferedWriter bw = new BufferedWriter(oStrW); + mapWriter = new CsvMapWriter(bw, CsvPreference.STANDARD_PREFERENCE); String isValidTab = isValidTabToExport(gridTab); if(isValidTab!=null){ throw new AdempiereException(isValidTab);