NetTopologySuite / NetTopologySuite.IO.ShapeFile

The ShapeFile IO module for NTS.
33 stars 25 forks source link

set encoding bug #19

Closed bouyeijiang closed 1 month ago

bouyeijiang commented 5 years ago

set encoding error: this my code sample: ShapefileDataWriter.GetHeader(features[0], features.Count,Encoding.UTF8); error msg: Setting the encoding is only allowed once, either by means of the constructor or this property setter

and chinese random code error

akamsteeg commented 4 years ago

I worked around this issue by setting an encoding in the constructor too:

this._shapeFileWriter = new ShapefileDataWriter(streamRegistry, geometryFactory, Encoding.Default);

And I'm using the same encoding when writing the header:

this._shapeFileWriter.Header = ShapefileDataWriter.GetHeader(this._features[0], this._features.Count, Encoding.Default);
KubaSzostak commented 1 month ago

Support for a different encodings has been added in the successor library. There is also a sample code demonstrating how to custom encoding.