Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#2220 closed enhancement (fixed)

Support writing the LDID (character encoding of shapefiles)

Reported by: francoisb Owned by: mcayland
Priority: medium Milestone: PostGIS 2.2.0
Component: utils/loader-dumper Version: 2.0.x
Keywords: shapefile encoding Cc:

Description

It would be great to populate during export from PostGIS the LDID field (language driver ID) needed by many shapefile readers.

This header is an optional feature of .dbf files specifying the character encoding of its text attributes (UTF-8, CP1251, etc.). Some popular GIS tools (including OGR library, QGIS) are mis-interpreting the encoding of a shapefile that is missing this header.

The dumper pgsql2shp should set this header, as PostreSQL knowns what encoding it is writing to.

A similar functionality is provided by ".cpg" side files, that can carry the same encoding information. The dumper could optionally write these too.

Change History (3)

comment:1 by pramsey, 11 years ago

Milestone: PostGIS 2.2.0

I added *reading* the LDID information for 2.1, haven't done anything on writing yet.

comment:2 by pramsey, 9 years ago

Resolution: fixed
Status: newclosed

OK, at r14090 we will try to be more smart about writing encodings. The old behaviour was almost certainly bad/wrong, as we were letting shapelib write a default LDID number that mean WIN-1252 while writing back what we got from the database, which was by default almost always UTF8. By more explicitly opening the DBF file as a UTF-* file, we should get a .cpg file sidecar that indicates UTF-8 and hopefully client software will also be more happy with our outputs. Unfortunately there's no common LDID value for UTF-8, so the sidecar seems a necessity.

comment:3 by Redoute, 9 years ago

Thank you!

Note: See TracTickets for help on using tickets.