Ticket #4359 (closed enhancement: worksforme)

Opened 18 months ago

Last modified 18 months ago

Shapefile: SHAPE_ENCODING

Reported by: peifer Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

I noted that without SHAPE_ENCODING=UTF-8, the driver defaults to writing new dbf files in IS0-8859-1 encoding. Wouldn't it be better to default to UTF-8? Difficult terrain, I know. Just to let you know that most people I know need to handle more characters than are available in the "Western European" character set.

Independent of the above question: could it make sense to generate .cpg files while writing new shapefiles? (... as ogr2ogr also seems to honour existing ones).

Change History

  Changed 18 months ago by rouault

try adding "-lco ENCODING=UTF-8" to the command line. SHAPE_ENCODING mostly affects the the reading part of the shapefile driver

  Changed 18 months ago by peifer

Hmm. Will it help (I guess: not) to do:

$ export ENCODING=UTF-8

The documentation [1] says that SHAPE_ENCODING makes a difference while opening files. Is creating shapefiles something different to opening non-existing ones?

And if you could comment on the "cpg part" of my question.. Thanks!

[1] http://trac.osgeo.org/gdal/wiki/ConfigOptions#SHAPE_ENCODING

  Changed 18 months ago by rouault

Did you have a look at  http://gdal.org/ogr/drv_shapefile.html which explains (succintely!) both the SHAPE_ENCODING config options and the ENCODING layer creation option ? The ConfigOptions wiki page is just a catalog, and doesn't contain all details.

Yes, -lco ENCODING=UTF-8 produces a .cpg file because it is not a code recognized by the DBF format.

  Changed 18 months ago by peifer

  • status changed from new to closed
  • resolution set to worksforme

Sorry, I misjudged the ConfigOptions page as being a convenient way to have a detailed overview across the various GDAL/OGR config options. I did read actually read drv_shapefile.html at some point in time, but I keep forgetting to revisit it. I will put a recurring reminder in my calendar.

I close the ticket and put the marker on WorksForMe?. Putting it on Invalid would be too depressing ;-)

follow-up: ↓ 6   Changed 18 months ago by rouault

Feel free to edit ConfigOptions to mention that for the writing part, the ENCODING layer creation option should be rather used, and add a link to the shapefile driver page. That's the put of a wiki ;-)

in reply to: ↑ 5   Changed 18 months ago by peifer

Replying to rouault:

Feel free to edit ConfigOptions...

I'll think about it. If I understood correctly, the Wiki pages are a loose collection of GDAL wisdom contributed by a loose community of GDAL users. I wonder if the collection wouldn't become even looser, if I start contributing. So far I only made 2 Wiki edits, where I found some content to be factually wrong. I think I will limit myself to this type of Wiki edits.

Note: See TracTickets for help on using tickets.