THE FILE FIELD GUIDE
.cpg

Shapefile Encoding Sidecar

Maps & GPS

CPG can specify Shapefile attribute encoding. Geometry and attributes live in SHP/DBF companions; CPG alone is not a map.

Main use
Describe the attribute table’s character encoding
Data type
Text data
All sections, questions and sources

Content reviewed: · Editor:Kai

Opening steps

Choose your environment or purpose to see its steps.

QGIS / GDAL

Preserve the original and inspect a working copy in a compatible application.

  1. Inspect the encoding declaration as text.
  2. Gather matching SHP, SHX, DBF and sidecars.
  3. Load SHP in GIS and inspect Japanese attributes.
Inspect the received file and its requirements

Establish dependencies and settings before proceeding.

  1. Match the basename across the set.
  2. Check the publisher’s stated encoding.
  3. Retain originals before renaming/editing.

Menu labels and support vary by app, OS and version. Preserve the original before making changes.

Troubleshooting by symptom

  • No map: obtain the geometry dataset.
  • Garbled text: compare CPG declaration and DBF encoding.
  • Encoding differs elsewhere: inspect GIS detection/settings.
  • No CPG: ask the publisher rather than guessing.

Dataset with CPG → GeoPackage or another format

  1. Verify decoded attributes, then export a separate dataset.
  2. Reopen the output and check it against the preservation points in this guide before handoff.

Saving incorrectly decoded text can make corruption persistent.

A declaration does not transcode data

Changing CPG to UTF-8 does not transcode DBF bytes; use correct GIS read/write settings.

Source for these steps:GDAL · ESRI Shapefile / DBF / QGIS · General Tools — Styles

Worked example: checks before handoff

Example: inspect several municipality names before and after export.

Source for these steps:GDAL · ESRI Shapefile / DBF / QGIS · General Tools — Styles

Related-format differences

Related-format differences
Format / methodPurpose and preserved information
.cpgDescribe the attribute table’s character encoding
PRJ / DBFCoordinate system / attribute payload.
Dataset with CPG → GeoPackage or another formatSaving incorrectly decoded text can make corruption persistent.

Handling and security

Review attribute privacy before sharing.

Questions and answers

Is CPG alone a map?

It is encoding metadata.

Can it be discarded?

Retain it as part of the dataset.

Same as PRJ?

PRJ generally describes coordinates.

Format facts: name, steward and MIME type
Formal name
Shapefile Encoding Sidecar
Steward / specification
GDAL
MIME type
Consult the producer or delivery system. The extension alone does not establish a MIME type.

Primary and official sources

  • Project documentationESRI Shapefile / DBF

    CPG encoding and PRJ coordinate systems.

    GDAL · Link checked:
  • Software documentationGeneral Tools — Styles

    Saving and loading QML/SLD styles.

    QGIS · Link checked: