Knowledge Base - Technical Articles


Technical Article   FAQ:  How does ArcPad read and write Shapefiles/DBF files encoded in various code pages?

Article ID: 26015
Software:  ArcPad 6.0.1, 6.0.2, 6.0.3
Platforms: N/A

Question

How does ArcPad read and write Shapefiles/DBF files encoded in various code pages?

Answer

ArcPad searches various places to determine the code page to use when reading and writing attributes and displaying labels for a particular shapefile. The decision is made when loading the Shapefile.

ArcPad prioritizes the code pages as follows:

 Special Note: In versions 6.0, 6.0.1, and 6.0.2, priorities 1 and 2 below are reversed. That is the LDID has the highest priority, while with version 6.0.3, the .CPG file has the highest priority.


1. ArcPad views the Shapefile's .CPG file. The code page identified in the .CPG file is used. The .CPG file has the same file name as the Shapefile, but uses a .CPG extension, for example:

ArcPad's locale is ENU (code page 1252), a Japanese shapefile is added with a .CPG file identifying code page 932. ArcPad uses code page 932 to correctly read/write Japanese attribute data. The code page is determined by using the .CPG file.

2. If the Shapefile does not contain a .CPG file, ArcPad checks if the Shapefile's DBF table contains a valid Language Driver ID (LDID) value in its header. If so, the corresponding code page is used. If the LDID value is 0x57, ArcPad uses the ANSI code page associated with the locale set in the Locale page of the ArcPad Options dialog box, for example:

ArcPad's locale is ENU (code page 1252), a Japanese shapefile is added with LDID 13 (code page 932) and no .CPG file. ArcPad uses code page 932 to correctly read/write Japanese attribute data. The code page is determined by the LDID value.

3. If the LDID value is 0 or not valid, ArcPad uses the code page specified in the Shapefile's APL file (the codepage attribute of the LOCALE element). For example:

ArcPad's locale is ENU (code page 1252), a Japanese shapefile is added with no .CPG file, no LDID value, but with a code page specified in its APL file (<LOCALE codepage="932"/>). ArcPad uses code page 932 to correctly read/write Japanese attribute data. The code page is determined by the APL file.

4. If no code page is specified in the Shapefile's APL file, ArcPad defaults to the code page associated with the locale set in the Locale page of the ArcPad Options dialog box; for example:

ArcPad's locale is ENU (code page 1252), a Japanese shapefile is added with no .CPG file, no LDID value, and no code page specified in its APL file. ArcPad uses code page 1252 to incorrectly read/write Japanese attribute data using western encoding. The code page is determined by defaulting to ArcPad's locale.

ArcPad's locale is JPN (code page 932), a Japanese shapefile is added with no CPG file, no LDID value, and no code page specified in its APL file. ArcPad uses code page 932 to correctly read/write Japanese attribute data. The code page is determined by defaulting to ArcPad's locale.


Related Information


Created: 11/25/2003
Last Modified: 1/26/2004

If you would like to post a comment, please login