Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#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)

ticket_1141.jpeg (10.6 KB ) - added by timlinux 16 years ago.
Example of error message when creating a shp
ticket_1141_patch.diff (1.7 KB ) - added by timlinux 16 years ago.
Patch which fixes the issue for me

Download all attachments as: .zip

Change History (9)

comment:1 by msieczka, 16 years ago

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.

comment:2 by timlinux, 16 years ago

Milestone: Version 1.0Version 0.11.0
Owner: changed from jef to timlinux
Status: newassigned

by timlinux, 16 years ago

Attachment: ticket_1141.jpeg added

Example of error message when creating a shp

by timlinux, 16 years ago

Attachment: ticket_1141_patch.diff added

Patch which fixes the issue for me

comment:3 by timlinux, 16 years ago

Status: assignednew

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

in reply to:  3 comment:4 by jef, 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.

comment:5 by jef, 16 years ago

Resolution: fixed
Status: newclosed

Maciej, could you please verify that both #1120 and #1141 are fixed? Please reopen, if either problem is still there.

in reply to:  5 comment:6 by jef, 16 years ago

Replying to jef:

Maciej, could you please verify that both #1120 and #1141 are fixed? Please reopen, if either problem is still there.

in r8759 that is.

comment:7 by (none), 15 years ago

Milestone: Version 0.11.0

Milestone Version 0.11.0 deleted

Note: See TracTickets for help on using tickets.