FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour test using fw_unicode
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
test using fw_unicode
Posted: Fri Oct 30, 2015 02:41 PM
Hi,
this little sample test does not work

I copy and paste some chinese characters like these 机器加工时间测量表
or I type some character using chinese keyboard

When get object looses focus all chinese characters disappear and appear a list of ??????
Any hints?
King regards
Marco

Code (fw): Select all Collapse
#include "fivewin.ch"
ANNOUNCE RDDSYS
FUNCTION MAIN()
LOCAL oDlg
LOCAL oCodice  , cCodice  := SPACE( 50 )
LOCAL oDes_Eng , cDes_Eng := SPACE( 100 )
LOCAL oDes_Chi , cDes_Chi := SPACE( 100 )

LOCAL oFont
LOCAL cFont  := "Courier New        "
LOCAL nSize  := 24


FW_SetUnicode( .t. )


MsgGet( "Insert" , "Font type"      , @cFont   )
MsgGet( "Insert" , "Font size"      , @nSize   )


SET DELETED ON
SET EXCLUSIVE OFF

USE items
INDEX ON field->codice  TAG CODICE  TO ITEMS
INDEX ON field->des_eng TAG DES_ENG TO ITEMS
SET ORDER TO TAG CODICE
GO TOP

DEFINE FONT oFont NAME cFont SIZE 0 , - nSize


DEFINE DIALOG oDlg FROM 100 , 100 TO 400 , 800 PIXEL
@ 1 ,  1 SAY "Codice" OF oDlg
@ 1 , 10 GET oCodice    VAR cCodice    OF oDlg SIZE 200 , 20

@ 3 ,  1 SAY "Descri English" OF oDlg
@ 3 , 10 GET oDes_Eng   VAR cDes_Eng   OF oDlg SIZE 200 , 20

@ 5 ,  1 SAY "Descri Chinese" OF oDlg
@ 5 , 10 GET oDes_Chi   VAR cDes_Chi   OF oDlg SIZE 200 , 20  FONT oFont

@ 7 ,  1 BUTTON "Cerca" OF oDlg  ACTION CERCA( oCodice , oDes_Eng , oDes_Chi )
@ 7 , 10 BUTTON "Salva" OF oDlg  ACTION SALVA( oCodice , oDes_Eng , oDes_Chi )
@ 7 , 20 BUTTON "Print" OF oDlg  ACTION PRINT_TEST( cFont )


ACTIVATE DIALOG oDlg Center


RELEASE FONT oFont

RETURN NIL

FUNCTION CERCA( oCodice , oDes_Eng , oDes_Chi )
LOCAL cCodice := oCodice:varget()

IF DBSEEK( cCodice )

   oDes_Eng:varput( items->des_eng )
   oDes_Chi:varput( items->des_chi )
   oDes_Eng:refresh()
   oDes_Chi:refresh()

ENDIF

RETURN NIL

FUNCTION SALVA( oCodice , oDes_Eng , oDes_Chi )
LOCAL cCodice := oCodice:varget()

IF DBSEEK( cCodice )
   IF DBRLOCK()
      REPLACE items->des_eng  WITH oDes_Eng:varget()
      REPLACE items->des_chi  WITH oDes_Chi:varget()
      DBRUNLOCK()
   ENDIF
ENDIF

RETURN NIL

FUNCTION PRINT_TEST( cFont )

   local oPrn := TPrinter():New( "Test" )  // "Test" is the name for the printout

   local fntArial
   local nRow := 1
   LOCAL nSize := 80
   LOCAL oFont

   MsgGet( "Insert" , "Font size"      , @nSize   )

   DEFINE FONT fntArial NAME "Arial" SIZE 0 , -80
   DEFINE FONT oFont    NAME cFont   SIZE 0 , - nSize

   oPrn:StartPage()
   GO TOP

                        // starts a new page
   DO WHILE !EOF()
      oPrn:Say( nRow * 100 ,   10 , field->codice  , fntArial )
      oPrn:Say( nRow * 100 , 1000 , field->des_eng , fntArial )
      oPrn:Say( nRow * 100 , 3000 , field->des_chi , oFont )

      nRow ++
      SKIP
   ENDDO

   oPrn:EndPage()                          // ends this page

   RELEASE FONT fntArial
   RELEASE FONT oFont
   oPrn:End()

RETURN NIL





INIT PROCEDURE RddInit
REQUEST DBFFPT
REQUEST DBFCDX
rddSetDefault( "DBFCDX" )
Marco Boschi
info@marcoboschi.it
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: test using fw_unicode
Posted: Fri Oct 30, 2015 03:07 PM

Please,
If you use Notepad or any other editor you have to save as UTF8 document

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: test using fw_unicode
Posted: Fri Oct 30, 2015 03:34 PM

In my prg files there are not chinese or strange characters
Can you compile it for me?
Many thanks
Marco

Marco Boschi
info@marcoboschi.it
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: test using fw_unicode
Posted: Fri Oct 30, 2015 03:52 PM
MarcoBoschi wrote:In my prg files there are not chinese or strange characters
Can you compile it for me?
Many thanks
Marco


Marco, As before
If you are not going to use Unicode characters, still working like
If you use unicode characters in xHarbour the .prg file must be saved as UTF8 without BOM
In Harbour you can record as UTF or UTF without BOM, anyway
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: test using fw_unicode
Posted: Fri Oct 30, 2015 04:19 PM

Cristobal,

I tried as per your suggestion but the result is the same. Can you try Marco's sample yourself?

EMG

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: test using fw_unicode
Posted: Fri Oct 30, 2015 04:23 PM

Cristobal,
can you try ma sample?
Many thanks
Marco

Marco Boschi
info@marcoboschi.it
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: test using fw_unicode
Posted: Fri Oct 30, 2015 05:07 PM
My email

navarro . cristobal at gmail . com

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: test using fw_unicode
Posted: Sat Oct 31, 2015 09:23 AM

Cristobal,
I' just sent the source and a dbf table

Gracias

Marco Boschi
info@marcoboschi.it
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: test using fw_unicode
Posted: Sat Oct 31, 2015 10:44 AM
Look



I just had to put Fw_SetUnico of (.T.) In the program and compile normally FiveDbu
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: test using fw_unicode
Posted: Sat Oct 31, 2015 10:53 AM

Cristobal,

can you send me your EXE to test it here?

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: test using fw_unicode
Posted: Sat Oct 31, 2015 11:00 AM

Sent

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: test using fw_unicode
Posted: Sat Oct 31, 2015 11:20 AM

Cristobal,

thank you, your EXE works fine here. But if I compile the PRG you sent me it doesn't work. I'm using latest FWH build 4. What am I missing? Any additional LIBs required?

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: test using fw_unicode
Posted: Sat Oct 31, 2015 11:22 AM
Enrico Maria Giordano wrote:Cristobal,

thank you, your EXE works fine here. But if I compile the PRG you sent me it doesn't work. I'm using latest FWH build 4. What am I missing? Any additional LIBs required?

EMG


No, standard libraries with Harbour

Which problem you have?
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: test using fw_unicode
Posted: Sat Oct 31, 2015 11:27 AM

Cristobal.

I just can't paste the chinese characters in the GET. When I try to paste them they change to question marks.

Any ideas?

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: test using fw_unicode
Posted: Sat Oct 31, 2015 11:28 AM

I'm using xHarbour. Does it make any differences?

EMG