[QGIS-trac] Re: [Quantum GIS] #1141: broken Polish characters
support since r8592
Quantum GIS
qgis at qgis.org
Sat Jul 12 04:58:56 EDT 2008
#1141: broken Polish characters support since r8592
--------------------------------------------------------------+-------------
Reporter: msieczka | Owner: timlinux
Type: bug | Status: new
Priority: critical: causes crash or data corruption | Milestone: Version 0.11.0
Component: Internationalisation | Version: HEAD
Resolution: | Keywords:
Platform_version: | Platform: Debian
Must_fix: Yes | Status_info: 0
--------------------------------------------------------------+-------------
Comment (by jef):
Replying to [comment:3 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.
--
Ticket URL: <https://trac.osgeo.org/qgis/ticket/1141#comment:4>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats
More information about the QGIS-trac
mailing list