Revision: 4499 http://sourceforge.net/p/jump-pilot/code/4499 Author: michaudm Date: 2015-06-17 06:19:43 +0000 (Wed, 17 Jun 2015) Log Message: ----------- read/write cpg file (codepage for shp/dbf)
Modified Paths: -------------- core/trunk/ChangeLog core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java Modified: core/trunk/ChangeLog =================================================================== --- core/trunk/ChangeLog 2015-06-17 05:27:35 UTC (rev 4498) +++ core/trunk/ChangeLog 2015-06-17 06:19:43 UTC (rev 4499) @@ -3,7 +3,7 @@ 2015-06-17 mmichaud <m.michael.mich...@orange.fr> * fix bug in dbf writer described in http://sourceforge.net/p/jump-pilot/mailman/message/34210973/ - * read and use cpg file (codepage for shp/dbf) if it exists + * read/write cpg file (codepage for shp/dbf) 2015-06-13 mmichaud <m.michael.mich...@orange.fr> * LayerView / AttributePanel selection synchronization Modified: core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java 2015-06-17 05:27:35 UTC (rev 4498) +++ core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java 2015-06-17 06:19:43 UTC (rev 4499) @@ -45,9 +45,7 @@ import org.geotools.shapefile.Shapefile; import javax.swing.*; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; +import java.io.*; import java.net.URL; import java.nio.charset.Charset; import java.util.*; @@ -246,6 +244,7 @@ String shpfileName; String dbffname; String shxfname; + String cpgfname; String path; String fname; @@ -293,6 +292,14 @@ String charsetName = dp.getProperty("charset"); if (charsetName == null) charsetName = Charset.defaultCharset().name(); writeDbf(featureCollection, dbffname, Charset.forName(charsetName)); + PrintWriter pw = null; + try { + cpgfname = path + fname_withoutextention + ".cpg"; + pw = new PrintWriter(new FileOutputStream(cpgfname)); + pw.write(Charset.forName(charsetName).name()); + } finally { + if (pw != null) pw.close(); + } // this gc will be a collection of either multi-points, multi-polygons, or multi-linestrings // polygons will have the rings in the correct order ------------------------------------------------------------------------------ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel