I create a ShapefileDataStore to create a new shapefile and call dataStore.createSchema(...) . But it does not work for utf-8 header fields. I checked the geotools source code and realized that it does not support utf-8.


public void writeHeader(...) throws IOException{

  line  844:

How can I create a new shapefile with desired utf-8 header fields?

note: The shapefile plugin can read utf-8 header fields but it cannot write them in utf-8 !

  • DBF (III) files were never designed to support anything but ASCII - if you would like to submit a fix please read the developer's guide (docs.geotools.org/latest/developer) or you could purchase comercial support for this issue. – Ian Turton Feb 2 '16 at 9:08
  • But I saw QGIS can write dbf files with utf-8 encoding. But dbf header can only contain field names with maximum of 10 characters. In utf-8 it evaluates to 5 characters. – Dariush Feb 2 '16 at 9:57
  • as I said DBF files aren't designed for modern computing, try to avoid using them – Ian Turton Feb 2 '16 at 9:58
  • Yes sir !!!!!!!! – Dariush Feb 2 '16 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.