[fdo-internals] SHP Provider: Writing Chinese Characters into DBF
Fails When the System locale is EN.
Xumeng Chen
Xumeng.Chen at autodesk.com
Tue May 5 05:03:20 EDT 2009
Hi All,
Recently, I am developing with SHP Provider to export an SHP file. During testing my code, I found sometimes the attributes of the features which contain Chinese Characters can't be written into the file correctly, and my system locale is English(US), the exportation failed, because Provider can't store correct attribute name in the DBF file.
After looking into the SHP provider code, I find that when provider wrote attribute into DBF file, the wide strings will be converted into multi-bytes with the current locale codepage. For example, in my machine the Chinese strings were converted with 1252 codepage which is not correct.
After finding this, I tried to modify the source code and hardcode the codepage to UTF-8, then the characters are written and recognized correctly, and it seems that all right but there is a limitation. The max length of attributes name in DBF is 11, if we convert all string with UTF-8, only 5 letters are support when users in FR/DE locale...
Does anyone have suggestion to my situation? Like how to work around it, or suggestion to my fixing?
Any suggestion is appreciated highly.
Thanks,
Jimmy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fdo-internals/attachments/20090505/7af33ab4/attachment.html
More information about the fdo-internals
mailing list