[GRASS-dev] fonts and character encoding
Glynn Clements
glynn at gclements.plus.com
Mon May 14 03:32:56 EDT 2007
Michael Barton wrote:
>
> On 5/12/07 2:08 PM, "Glynn Clements" <glynn at gclements.plus.com> wrote:
>
> >> How do I access locale charmap from TclTk or wxPython?
> >
> > Tcl:
> > set encoding [exec locale charmap]
> > Python:
> > encoding = Popen(["locale", "charmap"], stdout=PIPE).communicate()[0].strip()
> >
> > AFAICT, the resulting value will be valid for iconv(), and thus for
> > $GRASS_FT_ENCODING.
> >
> > Needless to say, this won't work on Windows.
>
> I'm reluctant to implement code that doesn't work with windows.
>
> > You can get the Windows
> > codepage by parsing the output from "mode con cp /status", although
> > there might be better solutions. iconv appears to accept cp??? for
> > most of the common ones (e.g. cp437 = US, cp850 = western Europe,
> > etc).
>
> Sorry to bother, but how can I get this information from within TclTk or
> wxPython?
set str [exec mode con cp /status]
regexp {[0-9]+} $str num
set encoding cp$num
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list