Characters in a shapefile do not appear correctly in the ModelBuilder preview


Product(s):WaterCAD, WaterGEMS, HAMMER, SewerGEMS, SewerCAD, StormCAD, CivilStorm, PondPack
Version(s):08.11.XX.XX and 10.XX.XX.XX
Area:Layout and Data Input

Problem

When using ModelBuilder with a Shapefile selected as the data source type, certain characters with UTF-8 encoding (ie. character set) do not appear correctly in the preview window.

For example, the following image was taken from the ArcMap attributes table the Shapefile was exported from.

When that Shapefile is selected in ModelBuilder the characters appear incorrectly as shown below.

Background

ModelBuilder does not currently support UTF-8 encoding for the Shapefile DBF file.
The original standard for DBF files is defined with ISO8859-1 encoding.
From ArcGIS 10.2 on, ESRI defaults to UTF-8 encoding.
Feature request #797333 was created to support UTF-8 encoding in a future release.

Solution

Open the Shapefile  and re-save it using "system" encoding. The Shapefile characters should display correctly after doing this.

There are multiple applications that have this capability, including QGIS and ArcCatalog.

For QGIS:

1. Add the Shapefile layer.

2. Right-click on the layer and select properties.

3. Select the General tab and set "Data source encoding" to UTF-8 > Apply > OK.

4. Right-click on the layer and select save as.

5. Enter a file name and set the encoding to system > OK.

For ArcCatalog:

Click here for instructions to export to a Shapefile.

Make sure that the DBF Unicode Format is set to "None".

After a new copy of the Shapefile is created with the "system" encoding the characters should display correctly in ModelBuilder and QGIS, however ArcMap will no longer display the characters correctly. To fix this, do the following.

  1. Create a text file that only contains the text "ISO8859-1" (without quotation marks).
  2. Save the new text file to the same directory that contains the .shp file.
  3. Change the text file's extension from .txt to .cpg. 

See Also

Importing external data using ModelBuilder - Building and updating

Download QGIS

Converting a geodatabase to shapefiles