Hi Feng,

Thanks for the patch!! The process of getting a patch applied is first 
having the module maintainer for shapefile ( cc'ing jesse on this 
message ) to first review the patch. Then he can apply it for you.

If is helpful to also create a task in the bug tracker

http://jira.codehaus.org/browse/GEOT

and to attach your patch to it.

-Justin

Feng min wrote:
> Hello,
> 
> I am new in the GeoTools user group. I try to read my shapefile using 
> GeoTools, but the returned Chinese characters from attribute have 
> encoding problem: all the attribute strings are encoded into ISO-8859-1 
> not the right local encoding. I tracked into the source codes, and found 
> that the encoding is set to "ISO-8859-1" in DbaseFileReader.java:
> 
> 
> 205 charBuffer = CharBuffer./allocate/(header .getRecordLength() - 1);
> 
> 206 Charset chars = Charset./forName/("ISO-8859-1" );
> 
> 207 decoder = chars.newDecoder();
> 
> However, the default encoding can not be changed, because it may lead to 
> wrong record length (each Chinese character occupy two bytes). Finally, 
> I added some codes to decode the string type attribute from ISO-8859-1 
> to local encoding, and it works.
> 
>  
> 
> 443 // set up the new indexes for start and end
> 
> 444 charBuffer .position(start).limit(end + 1);
> 
> 445 String s = charBuffer.toString();
> 
> 446
> 
> 448 // decode string from ISO-8859-1 to default encoding
> 
> 449 s = *new* String(s.getBytes("ISO-8859-1" ));
> 
> 450
> 
> 451 // this resets the limit...
> 
> 452 charBuffer.clear();
> 
> 453 object = s;
> 
> 454 * break*;
> 
> Does anyone else have better way to solve the encoding problem of 
> shapefile? I have no idea about how to commit the change to code 
> repository, and any suggestion will be appreciated?
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel


-- 
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to