1. GeoTools解析esri shape文件中文乱码原因?
GeoTools解析shape文件时,默认字符集为 ISO-8859-1
2. 解决办法
将shape文件数据源的字符集设为 “UTF-8”
URL url = new File(filePath).toURI().toURL();
//根据shp文件路径创建shp文件的数据源
ShapefileDataStore shapeDs = (ShapefileDataStore)new ShapefileDataStoreFactory().createDataStore(url);
//将shape文件数据源的字符集设为 "UTF-8"
shapeDs.setCharset(Charset.forName("UTF-8"));