[GRASS-dev] Re: [GRASS-stats] Sys.setlocale for GRASS6.4
Roger Bivand
Roger.Bivand at nhh.no
Sat Sep 5 05:05:02 EDT 2009
On Fri, 4 Sep 2009, Markus Neteler wrote:
> On Fri, Sep 4, 2009 at 9:26 PM, Glynn Clements<glynn at gclements.plus.com> wrote:
>> Markus Neteler wrote:
>>> @grass-dev: There are encoding issues with --interface-description
>>> which states UTF-8 also then the actual language encoding is different:
>
> [then -> when]
>
> ...
>> The --interface description option needs to either determine the
>> locale's encoding via e.g. nl_langinfo() and use that in the header,
>
> It seems to be already there?
>
> lib/gis/parser.c:
>
> static void G_usage_xml(void)
> {
> ...
> #if defined(HAVE_LANGINFO_H)
> encoding = nl_langinfo(CODESET);
> if (!encoding || strlen(encoding) == 0) {
> encoding = "UTF-8";
> }
> #else
> encoding = "UTF-8";
> #endif
> ...
> fprintf(stdout, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", encoding);
> fprintf(stdout, "<!DOCTYPE task SYSTEM \"grass-interface.dtd\">\n");
>
> Apparently the Windows built was missing HAVE_LANGINFO_H or it
> isn't properly set on Windows.
As a work-around, I've submitted to CRAN a revised version of spgrass6
allowing the user to manipulate the encoding string in the XML data
directly, since Windows users of binary releases cannot get at this
themselves on the GRASS side.
The user would typically run a parseGRASS(<whatever>) command, see a UTF-8
error message, and then try inserting usual suspects with setXMLencoding()
- typically "latin1" - and retry parseGRASS(<whatever>). Users of
initGRASS() will see the UTF-8 error because parseGRASS("g.region") is run
when the function completes.
Roger
>
> ?
> Markus
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the grass-stats
mailing list