Skip to content
Novus Examples
cpg6 B

Shapefile Code Page — UTF-8 Declaration

The sidecar that declares `attributes-utf8.dbf` as UTF-8. Note that the DBF also carries a language-driver byte in its header, and the two can disagree — which is exactly the ambiguity a reader has to resolve and document.

Preview — first 2 linescpg
UTF-8

Specifications

Format
Esri shapefile component
Crs
WGS 84 (EPSG:4326)
Byte Order
mixed — big-endian headers, little-endian records
Sidecar Set
.shp/.shx/.dbf/.prj/.cpg
Content
UTF-8
Line Endings
LF
Declares Encoding Of
attributes-utf8.dbf
Language Driver Id In Dbf
0x00

Testing contract

Expected to pass
Scenario
Resolve the DBF encoding when the .cpg sidecar and the header language-driver byte both carry information.
Expected result
The reader states which of the two it trusts. For the cp1252 pair they disagree, so a reader that silently picks one is making an undocumented choice.

What is a .cpg file?

A .cpg file is a one-line sidecar naming the character encoding used by a shapefile's .dbf attribute table — typically UTF-8, or a legacy code page such as ISO-8859-1 or CP1252. The dBase format has no reliable in-band encoding declaration, so without this file a reader has to guess, and non-ASCII attribute values come back as mojibake.

How to use this file

Use an example .cpg file to test shapefile readers' encoding handling, confirming that the declared code page is applied to .dbf string fields and that a missing or contradictory .cpg is reported rather than silently guessed.

How to use this file for testing

“Shapefile Code Page — UTF-8 Declaration” is a deterministic Novus Examples fixture for Geospatial, Encoding detection, Metadata testing. GeoJSON, GPX, and KML files with points, lines, polygons, and tracks — for testing map tools, route parsers, and geo importers.

Documented properties for this file: LF · Esri shapefile component. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Geospatial fixtures publish one invented territory across formats, with the coordinate reference system and feature counts documented in specs. Convert or reproject and diff against the twin in the same group; edge-case geometries state exactly which assumption they are built to break.

Generated by generation/geospatial.py. Free for any use, no attribution required — license.