xbikuna / nettopologysuite

Automatically exported from code.google.com/p/nettopologysuite
0 stars 0 forks source link

ShapefileDataReader error 'The output char buffer is too small to contain the decoded characters' #161

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Get UK Lower Super Output Area data from 
https://geoportal.statistics.gov.uk/Docs/Boundaries/Middle_layer_super_output_ar
eas_(E+W)_2011_Boundaries_(Generalised_Clipped).zip
2. Read the data to the end (see test code below)
3. After record 34,753 (last one has LSOA11CD field set to W01001958) it fails. 
Note that the RecordCount for the file is 34,753 so it most likely is something 
at the end of the file.

The error text is
'The output char buffer is too small to contain the decoded characters, 
encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'.'

NUnit test code to provide this is

        [Test]
        public void TestLSOA2011ShapeFile()
        {

            //SETUP
            var filePath = Path.Combine(TestFileHelpers.GetTestDataFileDirectory(), "shapefiles", "LSOA_2011_EW_BGC.shp");

            //ATTEMPT
            using (var reader = new ShapefileDataReader(filePath, GeometryFactory.Default))
            {
                var header = reader.ShapeHeader;

                while (reader.Read() )//&& count++ < 3)
                {
                    Debug.WriteLine("{0}", reader["LSOA11CD"]);
                }
            }

            //VERIFY       

        }

Other notes:
- The file MSOA_2011_EW_BGC from the same source works correctly.

I am using NuGet versions
NetToploogySuite 1.13.1
NetToploogySuite.IO 1.13.1

Original issue reported on code.google.com by jon.sm...@selectiveanalytics.com on 19 Oct 2013 at 3:43

GoogleCodeExporter commented 8 years ago
Sorry, the note on item 3 should say 'Note that the DbaseHeader.NumRecords is 
34,753 so it most likely is something at the end of the file'.  

Original comment by jon.sm...@selectiveanalytics.com on 19 Oct 2013 at 4:34

GoogleCodeExporter commented 8 years ago
Fixed with r1079

Original comment by felix.ob...@netcologne.de on 24 Oct 2013 at 12:39