Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for non latin1/utf8 encodings in geoserver #59

Open
drh-stanford opened this issue Jul 8, 2015 · 5 comments
Open

support for non latin1/utf8 encodings in geoserver #59

drh-stanford opened this issue Jul 8, 2015 · 5 comments

Comments

@drh-stanford
Copy link

drh-stanford commented Jul 8, 2015

example: ty249zp2774 has a chinese encoding but geoserver shows inspection results as utf8/latin1

see

# first try decoding with UTF-8 and if that fails use LATIN1
begin
run_shp2pgsql(projection, 'UTF-8', shpfn, schema, druid, sqlfn, errfn)
rescue RuntimeError => e
run_shp2pgsql(projection, 'LATIN1', shpfn, schema, druid, sqlfn, errfn)
end

@drh-stanford
Copy link
Author

For example:

https://earthworks.stanford.edu/catalog/stanford-ty249zp2774

inspection shows wrong character encoding...

screen shot 2015-07-08 at 12 44 23 pm

@drh-stanford
Copy link
Author

Another example is yq395kh3847

screen shot 2015-07-09 at 10 58 05 am

@drh-stanford
Copy link
Author

some shapefiles come with .cpg files that will have the character encoding. the data appear corrupted in the PostGIS database so the shp2pgsql is where we need to set the encoding. We currently try UTF8 and then LATIN1.

@drh-stanford
Copy link
Author

FYI - The yq395kh3847 example is encoded in the BIG5 encoding. If you load it into QGIS with BIG5, then the characters show up.

screen shot 2018-02-12 at 3 49 19 pm

@drh-stanford
Copy link
Author

using shp2pgsql -W BIG5 fixes this particular layer -- the problem is that we don't know the character encoding, in general. the .dbf file is just binary data and you have to try different encodings until it works (visual inspection).

screen shot 2018-02-12 at 4 00 20 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant