2
2
# #
3
3
# A init.g GAPDoc Frank Lübeck / Max Neunhöffer
4
4
# #
5
- # H @(#)$Id: init.g,v 1.13 2007-03-05 16:51:11 gap Exp $
5
+ # H @(#)$Id: init.g,v 1.14 2007-05-09 12:58:12 gap Exp $
6
6
# #
7
7
# Y Copyright (C) 2000, Frank Lübeck and Max Neunhöffer,
8
8
# Y Lehrstuhl D für Mathematik, RWTH Aachen
@@ -25,3 +25,40 @@ ReadPackage("GAPDoc", "lib/Examples.gd");
25
25
# The handler functions for GAP's help system are read now:
26
26
ReadPackage(" GAPDoc" , " lib/HelpBookHandler.g" );
27
27
28
+ # try to find terminal encoding
29
+ GAPInfo.tmpfunc := function ()
30
+ local env, pos, enc, a;
31
+ if not IsBound (GAPInfo.TermEncoding) then
32
+ if IsList(GAPInfo.SystemEnvironment) then
33
+ # for compatibility with GAP 4.4.
34
+ env := rec ();
35
+ for a in GAPInfo.SystemEnvironment do
36
+ pos := Position(a, ' =' );
37
+ env.(a{[ 1 .. pos- 1 ]} ) := a{[ pos+ 1 .. Length(a)]} ;
38
+ od ;
39
+ else
40
+ env := GAPInfo.SystemEnvironment;
41
+ fi ;
42
+ enc := fail ;
43
+ if IsBound (env.LC_CTYPE) then
44
+ enc := env.LC_CTYPE;
45
+ fi ;
46
+ if enc = fail then
47
+ enc := env.LC_ALL;
48
+ fi ;
49
+ if enc = fail then
50
+ enc := env.LANG;
51
+ fi ;
52
+ if enc <> fail and
53
+ (PositionSublist(enc, " .UTF-8" ) <> fail or
54
+ PositionSublist(enc, " .utf8" ) <> fail ) then
55
+ GAPInfo.TermEncoding := " UTF-8" ;
56
+ fi ;
57
+ if not IsBound (GAPInfo.TermEncoding) then
58
+ # default is latin1
59
+ GAPInfo.TermEncoding := " ISO-8859-1" ;
60
+ fi ;
61
+ fi ;
62
+ end ;
63
+ GAPInfo.tmpfunc();
64
+ Unbind (GAPInfo.tmpfunc);
0 commit comments