Page 2 of 3

Re: ANSI -> UT8 Conversion

Posted: Thu Dec 12, 2013 8:08 pm
by srvet_claudio
mustafa wrote:Hola Mol
Curiosamente si pones:
@ 210,100 LABEL Label_c VALUE "ampersand "+ chr(038) WIDTH 290 HEIGHT 25 FONT "ARIAL" SIZE 14
solo sale ------------> ampersand , no sale simbolo &
pero si pones:
@ 310,100 LABEL Label_d VALUE "ampersand "+"&" + chr(038) WIDTH 290 HEIGHT 25 FONT "ARIAL" SIZE 14
sale correcto --------> ampersand &
Guardado fichero con UTF-8
Curioso
Mustafa
*-------------------------------------------------*
Hello Mol
Interestingly if you put:
@ 210,100 Label_c LABEL VALUE "ampersand" + chr (038) 290 HEIGHT 25 WIDTH FONT "ARIAL" SIZE 14
only goes ------------> ampersand, no sale symbol &
but if you put:
@ 310.100 Label_d LABEL VALUE "ampersand" + "&" + chr (038) 290 HEIGHT 25 WIDTH FONT "ARIAL" SIZE 14
goes right ampersand &
save file with UTF-8
curious
Mustafa
Amigo Mustafa,
Para mostrar caracteres en Unicode debes reemplar CHR() y ASC() por:

Code: Select all

SET CODEPAGE TO UNICODE
msgdebug ( nCode:=HB_UCODE("&") , HB_UCHAR(nCode) )

Re: ANSI -> UT8 Conversion

Posted: Thu Dec 12, 2013 8:44 pm
by mustafa
Hola amigo Claudio, como estas ?
gracias por el ejemplo, pero no entiendo mucho la respuesta como aplico
tu sample al Label ? le pongo
SET CODEPAGE TO UNICODE
nCode:=HB_UCODE("&") , HB_UCHAR(nCode)
@ 310.100 Label_d LABEL VALUE nCode 290 HEIGHT 25 WIDTH FONT "ARIAL" SIZE 14
me da Error y otra cosa que no entiendo, el fichero lo guardo con UTF-8 ? porque si
guardo con Unicode me da Error
Mustafa

Re: ANSI -> UT8 Conversion

Posted: Thu Dec 12, 2013 10:00 pm
by Javier Tovar
Hola mustafa,

Si no me equivoco lo que quiere decir el Amigo Claudio es emplear las funciones que el dice arriba como se hace con:

Code: Select all

Examples

     .  These examples illustrate CHR() with various arguments:

        ? CHR(72)                    // Result: H
        ? CHR(ASC("A") + 32)         // Result: a
        ? CHR(7)                     // Result: bell sounds

     .  These lines of code show the difference between a null string
        and the null character:

        ? LEN("")                   // Result: 0
        ? LEN(CHR(0))               // Result: 1
/////////////////////////////////////////////////////////////////////////////////////////

Examples

     .  These examples illustrate various results of ASC():

        ? ASC("A")                     // Result: 65
        ? ASC("Apple")                 // Result: 65
        ? ASC("a")                     // Result: 97
        ? ASC("Z") - ASC("A")          // Result: 25
        ? ASC("")                      // Result: 0

Siendo estas funciones reciprocas.

Saludos

Re: ANSI -> UT8 Conversion

Posted: Thu Dec 12, 2013 10:33 pm
by quartz565
thank you my friend !

regards,
Nikos

Re: ANSI -> UT8 Conversion

Posted: Fri Dec 13, 2013 2:11 pm
by srvet_claudio
mustafa wrote:Hola amigo Claudio, como estas ?
gracias por el ejemplo, pero no entiendo mucho la respuesta como aplico
tu sample al Label ? le pongo
SET CODEPAGE TO UNICODE
nCode:=HB_UCODE("&") , HB_UCHAR(nCode)
@ 310.100 Label_d LABEL VALUE nCode 290 HEIGHT 25 WIDTH FONT "ARIAL" SIZE 14
me da Error y otra cosa que no entiendo, el fichero lo guardo con UTF-8 ? porque si
guardo con Unicode me da Error
Mustafa
Hola Mustafa, yo me encuentro bien, espero que tu y tu familia también.

Code: Select all

SET CODEPAGE TO UNICODE

nCode:=HB_UCODE("&") // Devuelve el código (numero) Unicode del caracter "&" 

@ 210,100 Label_c LABEL VALUE "ampersand" + HB_UCHAR(nCode) 290 HEIGHT 25 WIDTH FONT "ARIAL" SIZE 14  
HB_UCODE() --> equivale a ASC() en ANSI
HB_UCHAR() --> equivale a CHR() en ANSI

Sí, el fichero lo guardas como UTF-8.
Un abrazo,
Claudio.

Re: ANSI -> UT8 Conversion

Posted: Fri Dec 13, 2013 8:52 pm
by mustafa
Hola Claudio
Intento hacerlo como tu me indicas pero al complilar no sale
el simbolo "&", no creo que sea no trabajar con el IDE,
trabajo con Build.bat --- > c:\hmg.3.2\build.bat Main %*
el codigo fuente es:

#include "hmg.ch"
Function Main
SET CODEPAGE TO UNICODE
DEFINE WINDOW Form_1;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE '' ;
MAIN

@ 050,100 LABEL Label_a VALUE "ampersand Antiguo "+"&" + chr(038) WIDTH 290 HEIGHT 25 FONT "ARIAL" SIZE 14
*** Para mostrar caracteres en Unicode debes reemplazar CHR() y ASC() por:
*----------------------------------------------------------------------*
SET CODEPAGE TO UNICODE
msgdebug ( nCode:=HB_UCODE("&") , HB_UCHAR(nCode)
*-----------------------------------------------------------------------*
SET CODEPAGE TO UNICODE
nCode:=HB_UCODE("&") // Devuelve el código (numero) Unicode del caracter "&"
@ 080,100 LABEL Label_b VALUE "ampersand Claudio " + HB_UCHAR(nCode) WIDTH 290 HEIGHT 25 FONT "ARIAL" SIZE 14
@ 110,100 LABEL Label_c VALUE "ampersand Mustafa " + "&" + HB_UCHAR(nCode) WIDTH 290 HEIGHT 25 FONT "ARIAL" SIZE 14
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil

Guardado como UTF-8 con el Notepad
Un Saludo
Mustafa

Re: ANSI -> UT8 Conversion

Posted: Sat Dec 14, 2013 12:13 am
by esgici
Hi All

Notre ami Serge Girard gave some good enhancements : Error-tolerant file delete and rename and a nice background image :arrow:
Screen shoot of ANSI -> UT8 conversion - 2
Screen shoot of ANSI -> UT8 conversion - 2
CFANS2UT8-2.jpg (99.69 KiB) Viewed 4812 times
CFANS2UT8-2(src).zip
Source file of ANSI -> UT8 conversion - 2
(52.6 KiB) Downloaded 316 times
CFANS2UT8-2(exe).zip
Executable of ANSI -> UT8 conversion - 2
(1.16 MiB) Downloaded 287 times
Happy HMG'ing :D

Re: ANSI -> UT8 Conversion

Posted: Sat Dec 14, 2013 12:44 am
by srvet_claudio
mustafa wrote: Hola Claudio
Intento hacerlo como tu me indicas pero al complilar no sale
el simbolo "&", no creo que sea no trabajar con el IDE,
trabajo con Build.bat --- > c:\hmg.3.2\build.bat Main %*
el codigo fuente es:

#include "hmg.ch"
Function Main
SET CODEPAGE TO UNICODE
DEFINE WINDOW Form_1;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE '' ;
MAIN

@ 050,100 LABEL Label_a VALUE "ampersand Antiguo "+"&" + chr(038) WIDTH 290 HEIGHT 25 FONT "ARIAL" SIZE 14
*** Para mostrar caracteres en Unicode debes reemplazar CHR() y ASC() por:
*----------------------------------------------------------------------*
SET CODEPAGE TO UNICODE
msgdebug ( nCode:=HB_UCODE("&") , HB_UCHAR(nCode)
*-----------------------------------------------------------------------*
SET CODEPAGE TO UNICODE
nCode:=HB_UCODE("&") // Devuelve el código (numero) Unicode del caracter "&"
@ 080,100 LABEL Label_b VALUE "ampersand Claudio " + HB_UCHAR(nCode) WIDTH 290 HEIGHT 25 FONT "ARIAL" SIZE 14
@ 110,100 LABEL Label_c VALUE "ampersand Mustafa " + "&" + HB_UCHAR(nCode) WIDTH 290 HEIGHT 25 FONT "ARIAL" SIZE 14
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil

Guardado como UTF-8 con el Notepad
Un Saludo
Mustafa
Mustafa aquí esta la solución: viewtopic.php?p=31415#p31415

Re: ANSI -> UT8 Conversion

Posted: Sat Dec 14, 2013 5:00 pm
by dhaine_adp
Hi all,

There is also a UnicodeLib contributed by Mr. Kevin Carmody on http://www/hmgextended.com" onclick="window.open(this.href);return false; or from here:
http://groups.yahoo.com/group/harbourminigui/" onclick="window.open(this.href);return false;

FYI. It is well documented but haven't try to use the lib myself.

Regards,

Danny

Re: ANSI -> UT8 Conversion

Posted: Wed Dec 18, 2013 6:38 pm
by serge_girard
Hello All !

I upgraded the idea of Esgici and made a little tool that do the real conversion to your program: replace all occurences of LEN() with HMG_LEN(), ASC() with HB_UCODE(), etc...

Maybe the UNICODE experts can take a look at it and tell me if it is correct.

See attachtment and enjoy!

Serge