FW_SetUnicode mostrar valor GET con FWINLOG

Re: FW_SetUnicode mostrar valor GET con FWINLOG

Postby VictorCasajuana » Sat Jan 23, 2021 3:55 pm

cnavarro wrote:Look
Image


Ups!, esto es más raro aún, cVar y cGet obtienen valores diferentes cuando pasan por el get sin haber modificado nada en el propio get?
--------
¿ Y porque no ?
¿ And why not ?
User avatar
VictorCasajuana
 
Posts: 194
Joined: Wed Mar 28, 2018 4:38 pm
Location: Vinaròs

Re: FW_SetUnicode mostrar valor GET con FWINLOG

Postby nageswaragunupudi » Sat Jan 23, 2021 4:51 pm

Everything appears to be working perfectly for me here.
This is the program first posted by Mr. Viktor, converted to Source instead of Resource. I have added both cVar and cGet to FWINLOG.

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oGet, oFont, oBtnBmp
   local cVar := 'ñ Ñ a á à ä â A Á À Ä Â e é è ë ê E É È Ë Ê i í ì ï î I Í Ì Ï Î o ó ò ö ô O Ó Ò Ö Ô u ú ù ü û U Ú Ù Ü Û'
   local cGet := cVar

   FW_SetUnicode( .T. )

   FWINLOG cVar

   DEFINE FONT oFont NAME "Calibri" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 800,300 PIXEL TRUEPIXEL TITLE cVar FONT oFont

   @ 20,20 GET oGet VAR cGet SIZE 760,24 PIXEL OF oDlg

   oGet:cToolTip := cVar

   @ 60,20 BUTTONBMP oBtnBmp PROMPT cVar SIZE 760,30 PIXEL OF oDlg TOOLTIP cVar

   oBtnBmp:bAction := <||
                           FWINLOG cVar, cGet
                           MsgInfo(cVar)
                           return Nil
                      >

   ACTIVATE DIALOG oDlg CENTER
   RELEASE FONT oFont

return nil
 


Image

Both cVar and cGet are displayed correctly. I do not understand why is it not working for you there.

Can you please build and run this program with buildh.bat?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10249
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW_SetUnicode mostrar valor GET con FWINLOG

Postby nageswaragunupudi » Sat Jan 23, 2021 5:00 pm

Next, I tried with resources:

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

    local oDlg, oGet
    local cVar := 'ñ Ñ a á à ä â A Á À Ä Â e é è ë ê E É È Ë Ê i í ì ï î I Í Ì Ï Î o ó ò ö ô O Ó Ò Ö Ô u ú ù ü û U Ú Ù Ü Û'
    local cGet := cVar
    local oBtnBmp

    FW_SetUnicode( .T. )

    FWINLOG cVar

    DEFINE DIALOG oDlg;
           Resource "dialogo";
           Title cVar

    Redefine Get oGet;
             Var cGet;
             Id 4004;
             Of oDlg

    oGet:cToolTip := cVar

    Redefine ButtonBmp oBtnBmp ;
             Id 4003 Of oDlg;
             Prompt cVar ;
             ToolTip cVar

    oBtnBmp:bAction := <||
                            FWINLOG cVar, cGet, cVar == cGet
                            MsgInfo(cVar)
                            Return Nil
                       >

    ACTIVATE DIALOG oDlg CENTER

return nil
 


Image

Everything looks working correctly.
Please help me to understand what am I missing? Why are you getting incorrect results?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10249
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW_SetUnicode mostrar valor GET con FWINLOG

Postby nageswaragunupudi » Sat Jan 23, 2021 6:03 pm

Now, let us test MySql Unicode issues:

This is a generic program to test working with Unicode (utf8) on MySql server.
For this sample, I used a cloud server that is available to all of us, so that you can build this sample without changing the server address.

Code: Select all  Expand view
#include "fivewin.ch"

REQUEST HB_LANG_ESWIN
REQUEST HB_CODEPAGE_ESWIN

//----------------------------------------------------------------------------//

function Main()

   local oCn, oRs, oDlg, oFont, aData, cSql

   FW_SetUnicode( .t. )

   HB_CDPSELECT("ESWIN")
   HB_LangSelect( "ES" )


   aData := { { "KOREAN", Space( 20 ) }, { "CHINESE", Space( 20 ) }, ;
              { "TELUGU", Space( 20 ) }, { "HINDI",   Space( 20 ) }, ;
              { "SPANISH",Space( 20 ) } }

   FWCONNECT oCn HOST "208.91.198.197:3306" USER "gnraofwh" PASSWORD "Bharat@1950" DATABASE "fwhdemo" PORT "3306"
   if oCn == nil
      return nil
   endif

   oCn:DropTable( "utftest3" )
   if !oCn:TableExists( "utftest3" )
      oCn:CreateTable( "utftest3", { { "lang", "C", 10, 0, "PRI" }, { "text", "C", 20, 0, "utf8" } }, .f., "utf8" )
      ? oCn:CreateTableSQL( "utftest3" )
   endif

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 400,300 PIXEL TRUEPIXEL FONT oFont

   @  20,20 SAY "KOREAN " GET aData[ 1, 2 ] SIZE 340,22 PIXEL OF oDlg CHRGROUP CHR_WIDE
   @  50,20 SAY "CHINESE" GET aData[ 2, 2 ] SIZE 340,22 PIXEL OF oDlg CHRGROUP CHR_WIDE
   @  80,20 SAY "TELUGU " GET aData[ 3, 2 ] SIZE 340,22 PIXEL OF oDlg CHRGROUP CHR_WIDE
   @ 110,20 SAY "HINDI  " GET aData[ 4, 2 ] SIZE 340,22 PIXEL OF oDlg CHRGROUP CHR_WIDE
   @ 140,20 SAY "SPANISH" GET aData[ 5, 2 ] SIZE 340,22 PIXEL OF oDlg CHRGROUP CHR_WIDE

   @ 200,20 BUTTON "SAVE AND SHOW" SIZE 150,40 PIXEL OF oDlg ACTION ( ;
         oCn:Insert( "utftest3", "lang,text", aData, .t. ), ;
         XBrowse( oRs := oCn:utftest3 ), ;
         oRs:Close() )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   oCn:Close()

return nil

//----------------------------------------------------------------------------//
 


Image

I have used the FWH built-in MySql library that comes free along with FWH library and at the same time much better and simpler to use than others including ADO.

I do not find any problem with any Unicode language.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10249
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW_SetUnicode mostrar valor GET con FWINLOG

Postby cnavarro » Sat Jan 23, 2021 6:08 pm

Please try same sample with FWLOG ( and notepad )
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: FW_SetUnicode mostrar valor GET con FWINLOG

Postby nageswaragunupudi » Sat Jan 23, 2021 8:00 pm

Mr. Cristobal

I added FWLOG:
Code: Select all  Expand view

   oBtnBmp:bAction := <||
                           FWINLOG cVar, cGet, cVar == cGet
                           FWLOG cVar, cGet, cVar == cGet
                           MsgInfo(cVar)
                           return Nil
                      >
 


This is the notepad.exe:
Image

I have already tested this extensively.
I request you to build and run this program with buildh.bat in the samples folder:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oGet, oFont, oBtnBmp
   local cVar := 'ñ Ñ a á à ä â A Á À Ä Â e é è ë ê E É È Ë Ê i í ì ï î I Í Ì Ï Î o ó ò ö ô O Ó Ò Ö Ô u ú ù ü û U Ú Ù Ü Û'
   local cGet := cVar
   local cLog := cFileSetExt( ExeName(), "log" )

   FW_SetUnicode( .T. )
   FErase( cLog )

   FWINLOG cVar

   DEFINE FONT oFont NAME "Calibri" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 800,300 PIXEL TRUEPIXEL TITLE cVar FONT oFont

   @ 20,20 GET oGet VAR cGet SIZE 760,24 PIXEL OF oDlg

   oGet:cToolTip := cVar

   @ 60,20 BUTTONBMP oBtnBmp PROMPT cVar SIZE 760,30 PIXEL OF oDlg TOOLTIP cVar

   oBtnBmp:bAction := <||
                           FWINLOG cVar, cGet, cVar == cGet
                           FWLOG cVar, cGet, cVar == cGet
                           MsgInfo(cVar)
                           return Nil
                      >

   ACTIVATE DIALOG oDlg CENTER
   RELEASE FONT oFont

   WinExec( "notepad.exe " + cLog )

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10249
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW_SetUnicode mostrar valor GET con FWINLOG

Postby nageswaragunupudi » Sat Jan 23, 2021 8:17 pm

Here is the proof that FWH is working correctly:

Image

Now, please test this at your end and find out the cause of error at your end. Please build the sample in the samples folder with buildh.bat
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10249
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW_SetUnicode mostrar valor GET con FWINLOG

Postby VictorCasajuana » Sun Jan 24, 2021 4:30 pm

nageswaragunupudi wrote:Everything appears to be working perfectly for me here.
This is the program first posted by Mr. Viktor, converted to Source instead of Resource. I have added both cVar and cGet to FWINLOG.

Both cVar and cGet are displayed correctly. I do not understand why is it not working for you there.

Can you please build and run this program with buildh.bat?


Thank you for your time.
I compiled his example with buildh.bat and the result is even stranger...
Image
--------
¿ Y porque no ?
¿ And why not ?
User avatar
VictorCasajuana
 
Posts: 194
Joined: Wed Mar 28, 2018 4:38 pm
Location: Vinaròs

Re: FW_SetUnicode mostrar valor GET con FWINLOG

Postby Sistem » Mon Mar 15, 2021 5:40 am

ola, quando pego palavras de um arquivo texto em UTF8 não trabalha bem, ex:
Code: Select all  Expand view

#include "FiveWin.ch"

EXTERNAL HB_Lang_PT
EXTERNAL HB_CODEPAGE_PT850

Function main()
 Local oTxtFile, nNum, aRetorno, cRes

   HB_LangSelect( "PT" )
   HB_SetCodePage( "PT850" )
   FW_SetUnicode( .t. )

   oTxtFile := TTxtFile():New("arq.txt")
   nNum := oTxtFile:LastRec()
   oTxtFile:End()
   aRetorno:=FParseEx("arq.txt", "*")
   For x1=1 to 9
       cRes := Alltrim(aRetorno[x1,1])
       cRandRes := Alltrim(RandomTxt(Len(cRes), cRes))
       ? cRes+ " " + cRandRes
   next

Return nil
//-------------------------------------------------------------------------------------------------------------
function RandomTxt(nNum, cTxt)
   local aList := Array( nNum ), nAt, aRandom := {}, cTxtNw:="", nRam, cTxt2:="", xz

   AEval( aList, { |u,i| aList[ i ] := i } )

   do while Len( aList ) > 0
      nAt      := HB_RandomInt( 1, Len( aList ) )
      AAdd( aRandom, aList[ nAt ] )
      nRam :=  aList[ nAt ]
      ADel( aList, nAt, .t. )
      cTxtNw := cTxtNw + Subs(cTxt, nRam, 1)
   enddo
   For xz=1 to nNum
       cTxt2 = cTxt2 + Subs(cTxtNw, xz, 1)+" "
   Next

return cTxt2

[b]arq.txt em UTF[/b]*
acareação*test1
acaríase*teste2
acarídeo*test3
ácaro*test4
acasalação*teste5
determinação*teste6
imprevisível*testeeee
determinação*testetese
quiçá*teste
 
FWH2008 | xHarbour | BCC74 | SQLRDD
User avatar
Sistem
 
Posts: 226
Joined: Sun May 13, 2012 7:52 am

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 11 guests