[udig-devel] DbaseFileWriter problems on ugly strings
Andrea Antonello
andrea.antonello at gmail.com
Wed Jan 16 09:14:11 PST 2008
> Adding this to my list of things to do :P.
:) Sorry for that...
> I wonder if Geotools
> trunk can handle this case. Is there any way you can cut down the
> shapefile to a size where you can send it to me?
Yes, I send it to you offline.
Ciao,
Andrea
>
> Jesse
>
> Le 16-Jan-08 à 5:24 AM, Andrea Antonello a écrit :
>
> > I have a problem when trying to merge various layers to a shapefile.
> >
> > An exception is thrown from the DbaseFileWriter that is due to the
> > fact
> > that the content of the string was written with international
> > characters and on my pc they don't seem to be encoded properly.
> > Nevertheless, since I do not care about the content, I would not
> > expect
> > an error.
> >
> > The content is:
> >
> > ------------------------------------------------------------------
> >
> > schrÃÂÃÂÃÂÃÂÃÂÃÂÃÂäge
> > LÃÂÃÂÃÂÃÂÃÂÃÂÃÂänge der
> > BrÃÂÃÂÃÂÃÂÃÂÃÂÃÂücke 15 m, starke
> > VerÃÂÃÂÃÂÃÂÃÂÃÂÃÂängung der Abflusssekti
> >
> > ------------------------------------------------------------------
> >
> > for which bash's wc counts 317 bytes.
> >
> >
> > In the method getFieldString of the DbaseFileWriter the following
> > happens:
> >
> > int currentBytes=s.substring(0, Math.min(size,
> > s.length())).getBytes().length;
> >
> > where s.length() = 188
> > size, which is maxsize = 254
> > and currentBytes gets = 316
> >
> > so the following check gives true, which is ok, since international
> > chars are taken into account:
> >
> > if( currentBytes>size ){
> > char[] c=new char[1];
> > for( int index=size-1; currentBytes>size; index--){
> >
> > the following line throws an arrayoutofbounds, since the count of
> > the buffer is 188 and we are accessing position 253.
> >
> > c[0] = buffer.charAt(index);
> >
> > I don't understand exactly the problem, since the buffer is
> > initialized
> > with dimension 255 and it should not throw the exception.
> >
> >
> > Any idea on what the problem is?
> >
> >
> > Andrea
> > _______________________________________________
> > User-friendly Desktop Internet GIS (uDig)
> > http://udig.refractions.net
> > http://lists.refractions.net/mailman/listinfo/udig-devel
>
More information about the udig-devel
mailing list