On Tue, 11 Nov 2008, Szak�ts Viktor wrote:
Hi Chen and Viktor,
> I don't know the answer to this problem, but I've also
> found the codepage a problem in terminals (and also
> keyboard handling), so I use GTXWC and GTWVT, which are
> better at solving these.
Harbour in GTCRS and GTTRM supports very similar to FlagShip
configuration file for screen output translation. It should
be located in /etc/harbour/hb-charmap.def after installation.
in SVN it's in harbour/source/rtl/gtcrs/hb-charmap.def
Below is it's description from its header. FlagShip users
should find that it gives bigger possibilities.
Harbour should even accept and read native FlagShip charmap
files directly because they are subset of Harbour functionality.
Anyhow Harbour terminal GTs should work even without it.
It's enough to set valid terminal codepage.
HB_SETTERMCP( <cTermCP> [,<cHostCP>] [,<lBoxChar>] )
<cTermCP> is encoding used externally by terminal
<cHostCP> is encoding used inside Harbour application - by default it's
CP set by HB_SETCODEPAGE()
<lBoxChar> enables to control special Harbour feature.
When characters are display using box/line drawing
functions then terminal GTs shows them using CP437
by default. It allows to use box characters even if
national CP does not have them. If <lBoxChar> is TRUE
in the above function then it forces using national
CP for all letters defined in given <cHostCP> even if
they are displayed by box drawing functions.
Here is the full ChangeLog entry from xHarbour where I added these
functionality 1-st time. Later I added it also to Harbour with
new GT model and GT drivers.
2003-06-19 10:40 UTC+0200 Przemyslaw Czerpak <[EMAIL PROTECTED]>
* xharbour/include/hbapigt.h
* xharbour/include/hbextern.ch
* xharbour/source/rtl/gtcrs/gtcrs.c
* xharbour/source/rtl/gtnul/gtext.c
* xharbour/source/rtl/gtnul/gtnul.c
* xharbour/tests/dspchr.prg
+ Two new functions HB_SETKEYCP( <cTermCP> [,<cHostCP>] ) and
HB_SETTERMCP(<cTermCP> [,<cHostCP>] [,<lBoxChar>]) added.
HB_SETKEYCP() if for input key translation, HB_SETTERMCP()
sets both input (HB_SETKEYCP()) and output (HB_SETDISPCP())
translation. Now anyone who wants to ports his console apps from
Windows/DOS with its local code page to *nix with GTCRS and iso
standards only have to add two functions at the beginning of the
program: HB_SETCODEPAGE(<cWinCP>); HB_SETTERMCP(<cIsoCP>,.t.)
All translation should be done automatically.
eg. for Polish:
HB_SETCODEPAGE("PLMAZ")
HB_SETTERMCP("PLISO",.t.)
sets translation between Polish Mazovia code page to ISO-8859-2.
The programmer don't have to change anything more in his source
code.
Additionally GTTRM fully supports utf8 console mode which is autodetected
and in such case it translates displayed characters to unicode using
<cHostCP> specified by HB_SETTERMCP().
Internal HVM national collation and alpha/upper/lower sets are specified
by HB_SETCODEPAGE( <cpID> ) or SET( _SET_CODEPAGE, <cpID> )
For example and to make some tests you can look at tests/gtchars.prg
best regards,
Przemek
#
# $Id: hb-charmap.def 8323 2008-03-12 16:44:16Z druzus $
#
#=============================================================================
# Copyright 2003 Przemyslaw Czerpak <[EMAIL PROTECTED]>,
# See doc/license.txt for licensing terms.
#=============================================================================
# Table Syntax:
# <:> terminal[|terminal|terminal...] <space> comment
# <space> inchar <:> <space> outchar <space> modus
# <space> inchar-inchar <:> <space> outchar <space> modus
# @include
# where:
# inchar = decim/hex/alpha equivalent for input char
# outchar = decim/hex/alpha equivalent for output char (* same as inchar)
# modus = 0 default is: 1 for ?/??/say output, 2 for box output
# 1: standard, 2: alternate, 3: protect, 4: alternate-protect,
# 5: acsc chars
# include = name of terminal to include character translation
#
# outchar can conatin:
# * = inchar
# and operators:
# + = add, - = sub, | = or, & = and, ^ = xor
#
# values:
# [0-9]+ = decim value
# 0x[0-9A-Fa-f]+ = hex value
# '[.]+' = alpha value
#
# example:
# 'A'-'Z': *|0x20 1
# makes all output chars lower
#
# Harbour program is looking for this file in $HB_CHARMAP,
# $HB_ROOT/etc/harbour/hb-charmap.def, /etc/harbour/hb-charmap.def
# terminal name is taken from 'HB_TERM' or 'TERM' environment variable
# if terminal name contains '/' character then is divided to subsections
# by this char and then each of them is included f.e.:
# export HB_TERM=linux/acsc/maz2iso
# means that sections :linux, :acsc, :maz2iso will be loaded
# remember that first subsection name (linux) will be used for terminfo
# initialization
#
# default:
# 0-127: * 1
# 128-255: * 0
#
#-----------------------------------------------------------------------------
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour