-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Wrong codepage of shapefile #14989
Comments
Author Name: Alexander Bruy (@alexbruy) This is because 1.7.4 and master now compiled against GDAL 1.9.0. |
Author Name: zirneklitis - (zirneklitis -) When *.dbf file is re-saved with OpenOffice Calc, QGIS shows the correct characters with any given code page. Until any edits are saved within QGIS. Question marks are saved in place of any non-latin characters. It's impossible to switch the code page for any shape files created by QGIS. |
Author Name: Giovanni Manghi (@gioman) zirneklitis - wrote:
it is not qgis fault, is gdal one. see: http://ssrebelious.wordpress.com/2012/03/11/qgis-and-gdal1-9-encoding-issue-a-workaround/ this is because 1.7.3 works, it is compiled with an old release of gdal. |
Author Name: Alexander Bruy (@alexbruy) Bug in GDAL already fixed, see http://trac.osgeo.org/gdal/ticket/4650 |
Author Name: Giovanni Manghi (@gioman)
|
Author Name: zirneklitis - (zirneklitis -) Recompiled GDAl and QGIS: QGIS version: 1.8.0-Lisboa, QGIS code revision: a1255fc, Compiled against GDAL/OGR: 2.0dev, Running against GDAL/OGR: 2.0dev. Nothing has changed. The problem still remains. OS: Fedora 14 x64. |
Author Name: Alexander Bruy (@alexbruy) You can try custom QGIS build from NextGIS (http://nextgis.ru/en/nextgis-qgis/) where this issue solved
|
Author Name: Giovanni Manghi (@gioman) zirneklitis - wrote:
still a gdal issue, not a qgis one.
|
Author Name: zirneklitis - (zirneklitis -) I insist that this is a QGIS issue. GDAL 1.9.0 (and newer) is trying to interpret the encoding setting from the shape file itself. When creating a new shape file “ENCODING” should be passed as an attribute, which, obviously, is not done. Calling qgis from terminal allows two track down an warning messages. Saving non-Latin characters in a shape files generates following warning message: “Warning 1: One or several characters couldn't be converted correctly from UTF-8 to ISO-8859-1. On the other hand, most of the shape files used by users are without character encoding byte. So QGIS has to operate with environmental variable “SHAPE_ENCODING”. At present the only solution is to use the same character coding for the given QGIS session, e.g.:
The example above allows to create and edit shape files with UTF-8 as a character encoding (example for Linux users, Windows users must use “SET SHAPE_ENCODING=UTF-8”). Excerpt from http://trac.osgeo.org/gdal/wiki/ConfigOptions In C/C++ configuration switches can be set programmatically like this: #include "cpl_conv.h" Normally a configuration option applies to all threads active in a program, but they can be limited to only the current thread this way:
|
Author Name: zirneklitis - (zirneklitis -) The Linux example above should be as follows:
|
Author Name: Alexander Bruy (@alexbruy) zirneklitis - wrote:
This is GDAL issue. GDAL always reports that it returned attributes is UTF-8, even when attributes have different encoding. SHAPE_ENCODING environment variable didn't work in most cases. This bug was partially fixed (see http://trac.osgeo.org/gdal/ticket/4650), but some more fixes needed |
Author Name: Jürgen Fischer (@jef-n) Alexander Bruy wrote:
how? |
Author Name: Even Rouault (@rouault) Note that I've just pushed additonnal fixes in GDAL ( see http://trac.osgeo.org/gdal/ticket/4650 ) that should make OLCStringsAsUTF8 more reliable. |
Author Name: Tim Sutton (Tim Sutton) Hi Could you please provide a Free, minimal test dataset so the we can add a test to our test suit, along with an idea of how we can evaluate the test as passing. |
Author Name: Even Rouault (@rouault) I'm attaching a small shapefile generated by the following OGR Python script (needs latest GDAL trunk, to support recoding of field name from UTF-8 to CP936 - reading should be OK with GDAL 1.9)
|
Author Name: zirneklitis - (zirneklitis -) Who should create the .cpg files – GDAL or QGIS? Shape file with _.cpg_ present works as expected (partly – QGIS has no idea of the existence of this file). The attribute values are not crippled any more. More about *.cpg files:
|
Author Name: Minoru Akagi (@minorua) I installed GDAL 1.9.1 by using OSGeo4W. When I convert a dataset of Shapefile which dbf file has "19" value (it means "CP932") in LDID field to KML format with ogr2ogr, the following message is shown. Warning1: Recode from CP932 to UTF-8 not supported, treated as ISO8859-1 to UTF-8 The Japanese characters of generated KML file is incorrect. This will also result character corruption in QGIS. I think that recoding of GDAL with iconv library is not enabled now. I, as a Japanese user of the great softwares, desired that QGIS use GDAL with iconv library linked. |
Author Name: Minoru Akagi (@minorua) I've also reported this recoding issue to OSGeo4W Trac. |
Author Name: Minoru Akagi (@minorua) Sorry, I noticed that I had a problem, which had been solved already in latest GDAL trunk. There is no problem converting CP932 to UTF-8. |
Author Name: Jürgen Fischer (@jef-n)
|
MacOS : 12.6.3 Hello It seems that in QGIS 3.23.3 but also in LTR 3.22 in the vector layer import dialog for shape files the encoding pull-down selection for codepage/encoding has no influence how the db file is imported to QGIS. Correct display (codepage) of db values are only accomplishable after the import by select manualy correct codepage/encoding in layer properties (UTF-8 seems to be default). That is very confusing. Codepage/encoding selection at the import dialog worked in other versions, but I can not say when in which version it was the case. best |
Author Name: Stanislaw Kapustka (Stanislaw Kapustka)
Original Redmine Issue: 5255
Affected QGIS version: 1.7.4
When opening shapefiles, it doesn't matters what codepage You choose, it is always UTF-8 in QGIS 1.74, so polish letters are wrong displayed (when shapefile was saved in other codepage than UTF-8, of course). Other coding is on list but it not works. In QGIS 1.73 it works perfect. The same problem is in master version.
Related issue(s): #15040 (relates), #15349 (relates), #15355 (relates), #21264 (relates)
Redmine related issue(s): 5340, 5900, 5911, 13203
The text was updated successfully, but these errors were encountered: