Hi,
You are attaching DE850 and DEWIN to your Harbour applications
but then you are setting DE as main HVM CP. Such CP does not
exists in Harbour. If your code is using Windows CP-1252 encoding
then you should use:
HB_SETCODEPAGE("DEWIN")
If your code is using CP850 then you have problem. EURO sign U+20AC
does not exists in this CP and cannot be shown. You will need some
hacked CP850 unicode table attached to DE850 where you overwrite
characters at position you used to encode euro sign in your code
(probably it's chr(128)) with value 0x20AC.
BTW in current days locale are usually set by default to UTF8 and
terminals are set to this encoding too. Harbour terminals like
GTTRM detects it automatically so it will work correctly with any
external encoding you may set by HB_SETTERMCP() but this line:
HB_SETTERMCP("DEWIN","DE850")
does not seems to be correct.
BTW what encoding you used in your source code and what Harbour GT
terminal you are using?
best regards,
Przemek
Hi Claudia!
> Okay, I changed it to
> REQUEST HB_CODEPAGE_DEWIN
> HB_SETTERMCP("DEWIN")
Changed what?
Please be more precise because all functions in your example are
important and I cannot guess what exactly you are dooing.
> With that I get the german umlauts and most of the other signs
> alright. The ALTGR-3
> (little high 3) is the pipe sign and the Euro sign are wrong.
Looks that you are still use wrong codepage in your example.
"DE" does not exists in Harbour so your code still uses "EN"
as HVM CP. In such case above is expected behavior.
BTW I think that it's time to generate RTE when not existing
CP is used. Too much people reports problems which are caused
by wrong CP setting.
In this example which uses DEWIN as base CP:
#include "inkey.ch"
request HB_CODEPAGE_DE850
request HB_CODEPAGE_DEWIN
request HB_CODEPAGE_DEISO
proc main()
local nKey
set( _SET_CODEPAGE, "DEWIN" )
hb_setTermCP( "DEWIN" )
? "EURO SIGN:", chr( 128 )
?
while ( nKey := inkey( 0 ) ) != K_ESC
if nKey >= 32 .and. nKey <= 255
?? chr( nKey )
endif
enddo
return
'€' and '³' should be shown without any problems.
> I use utf8 on Debian Squeeze and Ubuntu Natty Narwal. The Code is
> IBM850
> which is I think CP850. I need the Euro sign as well for gtwin on Win7
> 32-Bit and 64-Bit.
So you have serious problem. IBM850 does not contain euro sign (U+20AC=>€).
It exists only in CP1252 used internally by DEWIN at position 128 so my
above example works correctly.
> With gttrm I get char 128 for Euro sign, with gtxwc I get char 170 for
> Euro sign.
Amazing. Euro sign exists only in the following CPs:
MS: CP1250, CP1251, CP1252, CP1253, CP1254, CP1255, CP1256, CP1257, CP1258
ISO: 8859-7, 8859-15, 8859-16.
In MS CPs it's at position 128 (few years ago MS changed its ANSI CPs
adding this character) and in ISO CPs it's at possition 164. ISO-8859-15
it's nearly the same as ISO-8859-1 but has few additional characters like
Euro sign (see http://de.wikipedia.org/wiki/ISO_8859-15) so I guess that
many users may prefer this mapping instead of ISO-8859-1. Anyhow I have
never heard about encoding which has Euro sign at position 170.
Can you create self contain example for Harbour or xHarbour like above
one which display chr(170) as euro sign in GTXWC so I can guess what
exactly you are doing? It's also possible that you are using some broken
or hacked font which gives you such results.
Anyhow if you set correct encoding then it should work with all GTs
in the same way, i.e. try above example with different GTs.
> Which codepage file I would have to change?
You have to use the one which contains all characters you plan to use.
If your code is in IBM850 encoding then you should convert it to some
other one which contains Euro sign or you should create your own
encoding (hacked IBM850) were you replace one character (i.e. 'Ç' at
position 128) with euro sign and then use it.
Anyhow it may always be source of problem when you exchange data with
other systems so I suggest to use one of official encodings.
> Gttrm shows a disfigured screen if you use the KDE-Konsole. If the
> Konsole window is
> bigger than you defined hight or width only 1/3 of the screen shows
> up. If the Konsole
> windows is smaler or fitting the screen is okay. Xterm doesn't show
> this problem.
Sorry but it's problably some problem with you KDE-KONSOLE binaries
or configuration. It works for me without any problems. It's of course
incredible slow in comparision to other terminals but it works.
Personally I preffer to use PTerm which is terminal from PuTTY for
Linux.
best regards,
Przemek
No good idea to change from IBM850 to CP1252 with Code which
is used for a Linux program, a DOS program and a xbase++
program with over 100 code files with 100 to 4000 code lines.
With:
#include "inkey.ch"
request HB_CODEPAGE_DE850
request HB_CODEPAGE_DEWIN
request HB_CODEPAGE_DEISO
set( _SET_CODEPAGE, "DEWIN" )
hb_setTermCP( "DEWIN" )
I get all wrong umlauts in menues and the boxes show ³ or + signs
in gttrm and gtxwc.
With
REQUEST HB_CODEPAGE_DE850
REQUEST HB_CODEPAGE_DEWIN
REQUEST HB_CODEPAGE_DEISO
HB_SETTERMCP("DEWIN")
I get in gttrm:
for Euro sign 'Ç'
for § -> frees the input
for ³ -> a pipe
I get in gtxwc:
for Euro sign left upper edge of a box
for § -> frees the input
for ³ -> a pipe
As example I modified inkeytst.prg in tests/:
---------------------------
#include "inkey.ch"
PROCEDURE main()
REQUEST HB_CODEPAGE_DE850
REQUEST HB_CODEPAGE_DEWIN
REQUEST HB_CODEPAGE_DEISO
HB_SETTERMCP("DEWIN")
ALTD(0)
TEST7()
?
QUIT
RETURN .t.
PROCEDURE TEST7()
LOCAL nKey, nMask, cText
CLS
vlin := replicate(chr(177),maxcol()+1)
vbox := replicate(chr(177),8)
@ 1,0 clear
@ 1,0 say vlin
@ 7,32,15,47 box vbox
? "For the last test, a loop is started and all keyboard and mouse"
? "events are allowed. Each event will be displayed. Press the TAB"
? "key to exit. Try moving the mouse, holding and releasing the mouse"
? "buttons as well as double-clicking the mouse buttons."
?
? "Press any key."
nMask := INKEY_ALL
SET(_SET_EVENTMASK, nMask)
set( _SET_CODEPAGE, "DEWIN" )
hb_setTermCP( "DEWIN" )
WHILE (nKey := INKEY( 0, nMask )) != K_TAB
DO CASE
CASE nKey == K_MOUSEMOVE
? "The mouse moved."
CASE nKey == K_LBUTTONDOWN
? "The left mouse button was pushed."
CASE nKey == K_LBUTTONUP
? "The left mouse button was released."
CASE nKey == K_RBUTTONDOWN
? "The right mouse button was pushed."
CASE nKey == K_RBUTTONUP
? "The right mouse button was released."
CASE nKey == K_LDBLCLK
? "The left mouse button was double-clicked."
CASE nKey == K_RDBLCLK
? "The right mouse button was double-clicked."
OTHERWISE
? "A keyboard key was pressed: ", nKey,;
IF( nKey >= 32 .AND. nKey <= 255, CHR( nKey ), "" )
END CASE
END WHILE
? "The TAB key ("+LTRIM(STR(nKey))+") was pressed. Exiting..."
RETURN
------------------
If I compile with gttrm the boxes show alright and the all letters are alright.
With the same code in my program I get the boxes wrong. I can't reproduce
it with this little program.
You can see the effect if you compile the gtxwc in Debian Linux (utf8). First
everything seems right. But it you get to the bottom of the page the boxes
change to + signs and the Euro sign is now char 172 and shows left upper edge of
a single line box.
In xHarbour I hacked uc850.c and got everything alright. In Harbour this hack
doesn't do:
for §: line 80: 0x00BA -> 0x00A7
for €: line 81: 0x00BC -> 0x20AC
for µ: line 82: 0x00C1 -> 0x00B5
Best regards
Claudia
I found the file harbour is using to set the Euro sign and some other signs.
Harbour is not using src/codepage/uc850.c but src/rtl/cdpapi.c.
I changed:
diff cdpapi.c /home/claudia/SVN/harbour/trunk/harbour/src/rtl/cdpapi.c
93c93
< 0x0078, 0x0079, 0x007A, 0x007B, 0x00B3, 0x007D, 0x007E, 0x007F,
---
> 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
98,99c98,99
< 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00A7,
< 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x20AC, 0x00A1, 0x00AB, 0x00BB,
---
> 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
> 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
101c101
< 0x2555, 0x00BC, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
---
> 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
Now I get Euro sign € (Alt-GR-e), § (Alt-GR-3), ³ (Alt-GR-3) and ¼ (Alt-GR-4) in
gtxwc and gttrm. (¼ is not official, but I need it in my programs).
One flaw: Alt-GR-< (Pipe) now shows ³ as well. But I don't need pipe in my
programs.
Best regards
Claudia
Am Freitag Mai 6 2011 schrieb Przemysław Czerpak: