那么在读取shp文件之前,手动调用一下ShapefileDataStore的setStringCharset方法即可
dataStore.setStringCharset(Charset.forName("UTF-8"));
由于这个方法在ShapefileDataStore的父类和实现接口AbstractDataStore、DataStore中都没有声明,所以在创建dataStore的时候必须声明为ShapefileDataStore。否则,就必须在构造方法中传入字符集的参数。
好读书 不求甚解 每有会意 便欣然忘食
dataStore.setStringCharset(Charset.forName("UTF-8"));
Recent Comments