#1141 closed bug (fixed)
broken Polish characters support since r8592
Reported by: | msieczka | Owned by: | timlinux |
---|---|---|---|
Priority: | critical: causes crash or data corruption | Milestone: | |
Component: | Internationalisation | Version: | Trunk |
Keywords: | Cc: | ||
Must Fix for Release: | Yes | Platform: | Debian |
Platform Version: | Awaiting user input: | no |
Description
QGIS no longer displays Polish (pl UTF-8 locale) characters in the table, labels and query results. It also fails to save a newly created shapefile if it's name contains Polish chars like ąęćń etc.
The last QGIS SVN trunk revision which handles Polish chars correctly is r8591. r8592 is when things went funky. Jürgen was the author.
Attachments (2)
Change History (9)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Milestone: | Version 1.0 → Version 0.11.0 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
follow-up: 4 comment:3 by , 16 years ago
Status: | assigned → new |
---|
Please test the attached patch. It resolves the shp creation issues for me - I was able to create a shp with polish chars both in name and in field names. I havent tested with grass. I also dont know if the patch will have sideeffects for people in other locales or previously closed bugs.
Please test and provide feedback.
Regards
Tim
comment:4 by , 16 years ago
Replying to timlinux:
Please test the attached patch. It resolves the shp creation issues for me - I was able to create a shp with polish chars both in name and in field names. I havent tested with grass. I also dont know if the patch will have sideeffects for people in other locales or previously closed bugs.
Hm, from
#include <stdio.h> #include <locale.h> int main(int argc, char **argv) { const char *value = "123.456"; const char *locale = setlocale(LC_ALL, NULL); const char *locales[] = {"C", "UTF-8", "foobar", "de_DE.UTF8", "foobar"}; printf("initial locale: %s\n", locale); int i; for(i=0; i<sizeof(locales)/sizeof(*locales); i++) { double val; const char *res = setlocale(LC_ALL, locales[i]); if(!res) res="(null)"; sscanf(value, "%lf", &val); printf("setlocale: argument=\"%s\" result=\"%s\" query=\"%s\" value=%.4lf\n", locales[i], res, setlocale(LC_ALL, NULL), val); } setlocale(LC_ALL, locale); printf("restored to \"%s\" locale: %s\n", locale, setlocale(LC_ALL, NULL)); }
I get:
initial locale: C setlocale: argument="C" result="C" query="C" value=123.4560 setlocale: argument="UTF-8" result="(null)" query="C" value=123.4560 setlocale: argument="foobar" result="(null)" query="C" value=123.4560 setlocale: argument="de_DE.UTF8" result="de_DE.UTF8" query="de_DE.UTF8" value=123,0000 setlocale: argument="foobar" result="(null)" query="de_DE.UTF8" value=123,0000 restored to "C" locale: C
"C" is a predefined locale and valid (as "POSIX"). Looks like "UTF-8" isn't and setlocale() doesn't actually change anything in that case.
So you're reverting r8692 and reopening #1120, without actually doing it ;)
I still don't see how r8692 has an effect as the locale should be properly restored - it should only last for the OSRImportFromProj4 call.
follow-up: 6 comment:5 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Correction - the query/edit issue applies only to GRASS vector layers. Polish chars are handled OK in case of Shapefiles tables.
As to Shapefiles, only the issue with saving it under a name with non-ASCII chars applies - eg. if I create a new Shapefile and try save it as "test_ąę", it will be saved as "test_".
Also I noticed that QGIS silently fails to create fields with non-ASCII chars when createing a new shapefile. Please issue an error instead.