Página 1 de 1

Acentuação - Hwgui UTF-8 x ANSI

Enviado: 14 Jan 2021 01:06
por susviela@bol.com.br
Estou com dificuldades de usar acentuação na HwGUI quando estou desenhando as telas.

Ambiente: Windows
Editor: NotePad++ (texto dos fontes em UTF-8 )

Se eu converter o fonte para ANSI e alterar o caracteres acentuados até aparecem corretos na interface gráfica, mas eu prefiro usar UTF-8.

Nesse link abaixo eu já tinha comentado esse problema, e resolvi com ANSI, mas agora quero resolver com UTF-8

https://pctoledo.org/forum/viewto ... AO#p117296
Captura de tela de 2021-01-14 00-52-44.png
Captura de tela de 2021-01-14 00-52-44.png (1.61 KiB) Exibido 2947 vezes
Captura de tela de 2021-01-14 00-52-24.png
Captura de tela de 2021-01-14 00-52-24.png (2.53 KiB) Exibido 2947 vezes
Já coloquei as dicas:

Código: Selecionar todos

REQUEST HB_CODEPAGE_UTF8EX  

hb_cdpSelect ( "UTF8EX" ) 
Não deu certo;

Acentuação - Hwgui UTF-8 x ANSI

Enviado: 14 Jan 2021 03:49
por marcosgambeta
Seguiu esta informação no hwgui.hbp ?

Código: Selecionar todos

# Uncomment these two lines to build HwGUI in Unicode mode
#-prgflag=-DUNICODE
#-cflag=-DUNICODE

Acentuação - Hwgui UTF-8 x ANSI

Enviado: 14 Jan 2021 10:57
por susviela@bol.com.br
marcosgambeta escreveu:Seguiu esta informação no hwgui.hbp ?
Obrigado, realmente não tinha feito isso, por desconhecimento mesmo, segui a orientação e continuo com o mesmo problema.
abaixo Meu arquivo já com as alterações sugeridas:

Código: Selecionar todos

#
# $Id: hwgui.hbp 2673 2018-10-19 09:17:38Z alkresin $
#

-3rd=hbide_version=1.0
-3rd=hbide_type=Lib
-3rd=hbide_title=hwgui
-3rd=hbide_output=hwgui

-inc
-hblib
-olib/hwgui
-n
-q0
-w
-es2
-iinclude

# Uncomment these two lines to build HwGUI in Unicode mode
-prgflag=-DUNICODE
-cflag=-DUNICODE
-cflag=-DHWG_USE_POINTER_ITEM
"{unix}-cflag=`pkg-config --cflags gtk+-2.0`"

@hwgui.hbm

===============

Também uso um BAT personalizado para compilar via linha de comando:

Código: Selecionar todos

@echo off

REM - 
REM -  Bat de compilacao HwGUI 
CLS

hbmk2  \hb32\hwgui\hwgui.hbc hbct.hbc Adm.prg

IF errorlevel 1 GOTO ERRO_COMPILAR

:COMPILACAO_ok

  Adm.exe

  GOTO FIM

:ERRO_COMPILAR
Pause 

:FIM

Acentuação - Hwgui UTF-8 x ANSI

Enviado: 14 Jan 2021 16:33
por marcosgambeta
Carlos,

Testei aqui seguindo este procedimento:

1) Programa de teste editado no Notepad++ em UTF-8

2) Programa de teste configurado para usar UTF-8

Código: Selecionar todos

REQUEST HB_CODEPAGE_UTF8EX
hb_cdpSelect( "UTF8EX" )
3) HWGUI compilada com as linhas abaixo ativadas

Código: Selecionar todos

-prgflag=-DUNICODE
-cflag=-DUNICODE
Os acentos apareceram corretamente.

Após ativar as linhas no hwgui.hbp. veja se realmente foi gerada uma nova compilação da HWGUI. Se for o caso, apague a compilação anterior (bibliotecas na pasta lib e pasta oculta .hbmk).

Acentuação - Hwgui UTF-8 x ANSI

Enviado: 14 Jan 2021 16:37
por susviela@bol.com.br
susviela@bol.com.br escreveu:Após ativar as linhas no hwgui.hbp. veja se realmente foi gerada uma nova compilação da HWGUI. Se for o caso, apague a compilação anterior (bibliotecas na pasta lib e pasta oculta .hbmk).
Eita que eu sou "Bagual" não recompilei a LIB

Falha nossa, vou testar.

Acentuação - Hwgui UTF-8 x ANSI

Enviado: 14 Jan 2021 17:01
por susviela@bol.com.br
OPA ....... enrolou as linhas aqui:
Fui reconstruir assim:

C:\hb32\hwgui>hbmk2 hwgui.hbp hbxml.hbp hwgdebug.hbp procmisc.hbp

Código: Selecionar todos

C:\hb32\hwgui>hbmk2 hwgui.hbp hbxml.hbp hwgdebug.hbp procmisc.hbp
hbmk2: Alvo atualizado: lib\libhwgui.a
hbmk2: Alvo atualizado: lib\libhbxml.a
hbmk2: Alvo atualizado: lib\libhwgdebug.a
hbmk2: Alvo atualizado: lib\libprocmisc.a

C:\hb32\hwgui>hbmk2 hwgui.hbp hbxml.hbp hwgdebug.hbp procmisc.hbp
hbmk2: Harbour: Compilando módulos...
hbmk2: Compilando...
source\winapi\hmonthc.prg: In function 'HB_FUN_HWG_INITMONTHCALENDAR':
source\winapi\hmonthc.prg:137:26: warning: passing argument 3 of 'CreateWindowEx
W' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from c:/hb32/comp/mingw/i686-w64-mingw32/include/windows.h:72:0
,
                 from source\winapi\hmonthc.prg:119:
c:/hb32/comp/mingw/i686-w64-mingw32/include/winuser.h:2135:26: note: expected 'L
PCWSTR {aka const short unsigned int *}' but argument is of type 'char *'
   WINUSERAPI HWND WINAPI CreateWindowExW(DWORD dwExStyle,LPCWSTR lpClassName,LP
CWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndPar
ent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam);
                          ^
../../../../source/winapi/draw.c: In function 'HB_FUN_HWG_SAVEBITMAP':
../../../../source/winapi/draw.c:816:20: warning: passing argument 1 of 'CreateD
CW' from incompatible pointer type [-Wincompatible-pointer-types]
    hDC = CreateDC( "DISPLAY", NULL, NULL, NULL );
                    ^
In file included from c:/hb32/comp/mingw/i686-w64-mingw32/include/windows.h:71:0
,
                 from ../../../../include/hwingui.h:17,
                 from ../../../../source/winapi/draw.c:15:
c:/hb32/comp/mingw/i686-w64-mingw32/include/wingdi.h:2694:24: note: expected 'LP
CWSTR {aka const short unsigned int *}' but argument is of type 'char *'
   WINGDIAPI HDC WINAPI CreateDCW(LPCWSTR pwszDriver,LPCWSTR pwszDevice,LPCWSTR
pszPort,CONST DEVMODEW *pdm);
                        ^
../../../../source/winapi/registry.c: In function 'HB_FUN_HWG_REGCREATEKEY':
../../../../source/winapi/registry.c:30:43: warning: passing argument 2 of 'RegC
reateKeyExW' from incompatible pointer type [-Wincompatible-pointer-types]
    if( RegCreateKeyEx( (HKEY)hb_parnl(1), hb_parc(2), 0, NULL, 0, KEY_ALL_ACCES
S,
                                           ^
In file included from c:/hb32/comp/mingw/i686-w64-mingw32/include/windows.h:76:0
,
                 from ../../../../source/winapi/registry.c:13:
c:/hb32/comp/mingw/i686-w64-mingw32/include/winreg.h:152:25: note: expected 'LPC
WSTR {aka const short unsigned int *}' but argument is of type 'const char *'
   WINADVAPI LONG WINAPI RegCreateKeyExW(HKEY hKey,LPCWSTR lpSubKey,DWORD Reserv
ed,LPWSTR lpClass,DWORD dwOptions,REGSAM samDesired,LPSECURITY_ATTRIBUTES lpSecu
rityAttributes,PHKEY phkResult,LPDWORD lpdwDisposition);
                         ^
../../../../source/winapi/registry.c: In function 'HB_FUN_HWG_REGOPENKEY':
../../../../source/winapi/registry.c:47:41: warning: passing argument 2 of 'RegO
penKeyExW' from incompatible pointer type [-Wincompatible-pointer-types]
    if( RegOpenKeyEx( (HKEY)hb_parnl(1), hb_parc(2), 0, KEY_ALL_ACCESS,
                                         ^
In file included from c:/hb32/comp/mingw/i686-w64-mingw32/include/windows.h:76:0
,
                 from ../../../../source/winapi/registry.c:13:
c:/hb32/comp/mingw/i686-w64-mingw32/include/winreg.h:176:25: note: expected 'LPC
WSTR {aka const short unsigned int *}' but argument is of type 'const char *'
   WINADVAPI LONG WINAPI RegOpenKeyExW(HKEY hKey,LPCWSTR lpSubKey,DWORD ulOption
s,REGSAM samDesired,PHKEY phkResult);
                         ^
../../../../source/winapi/registry.c: In function 'HB_FUN_HWG_REGSETSTRING':
../../../../source/winapi/registry.c:71:42: warning: passing argument 2 of 'RegS
etValueExW' from incompatible pointer type [-Wincompatible-pointer-types]
    if( RegSetValueEx( (HKEY)hb_parnl(1), hb_parc(2), 0, REG_SZ,
                                          ^
In file included from c:/hb32/comp/mingw/i686-w64-mingw32/include/windows.h:76:0
,
                 from ../../../../source/winapi/registry.c:13:
c:/hb32/comp/mingw/i686-w64-mingw32/include/winreg.h:195:25: note: expected 'LPC
WSTR {aka const short unsigned int *}' but argument is of type 'const char *'
   WINADVAPI LONG WINAPI RegSetValueExW(HKEY hKey,LPCWSTR lpValueName,DWORD Rese
rved,DWORD dwType,CONST BYTE *lpData,DWORD cbData);
                         ^
../../../../source/winapi/registry.c: In function 'HB_FUN_HWG_REGSETBINARY':
../../../../source/winapi/registry.c:80:42: warning: passing argument 2 of 'RegS
etValueExW' from incompatible pointer type [-Wincompatible-pointer-types]
    if( RegSetValueEx( (HKEY)hb_parnl(1), hb_parc(2), 0, REG_BINARY,
                                          ^
In file included from c:/hb32/comp/mingw/i686-w64-mingw32/include/windows.h:76:0
,
                 from ../../../../source/winapi/registry.c:13:
c:/hb32/comp/mingw/i686-w64-mingw32/include/winreg.h:195:25: note: expected 'LPC
WSTR {aka const short unsigned int *}' but argument is of type 'const char *'
   WINADVAPI LONG WINAPI RegSetValueExW(HKEY hKey,LPCWSTR lpValueName,DWORD Rese
rved,DWORD dwType,CONST BYTE *lpData,DWORD cbData);
                         ^
hbmk2: Criando biblioteca estáticas... lib\libhwgui.a
hbmk2: Harbour: Compilando módulos...
hbmk2: Compilando...
hbmk2: Criando biblioteca estáticas... lib\libhbxml.a
hbmk2: Harbour: Compilando módulos...
hbmk2: Compilando...
hbmk2: Criando biblioteca estáticas... lib\libhwgdebug.a
hbmk2: Harbour: Compilando módulos...
hbmk2: Compilando...
hbmk2: Criando biblioteca estáticas... lib\libprocmisc.a

C:\hb32\hwgui>

Acentuação - Hwgui UTF-8 x ANSI

Enviado: 14 Jan 2021 17:09
por marcosgambeta
susviela@bol.com.br escreveu:OPA ....... enrolou as linhas aqui:
Apesar dos avisos do compilador, pode seguir em frente com os testes. A biblioteca hwgui foi gerada com avisos, mas sem erros.

Acentuação - Hwgui UTF-8 x ANSI [ RESOLVIDO ]

Enviado: 14 Jan 2021 17:13
por susviela@bol.com.br
Mesmo com os erros, apresentados, gerou a LIB e eu compilei o programa.

BINGO !!!
E a interface já está com os caracteres corretos, agradeço a orientação do colega.

marcosgambeta escreveu:1) Programa de teste editado no Notepad++ em UTF-8

2) Programa de teste configurado para usar UTF-8

Expandir visualizacao
Ver codigo
1 REQUEST HB_CODEPAGE_UTF8EX
2 hb_cdpSelect( "UTF8EX" )
3


3) HWGUI compilada com as linhas abaixo ativadas

Expandir visualizacao
Ver codigo
1 -prgflag=-DUNICODE
2 -cflag=-DUNICODE
3


Os acentos apareceram corretamente.

Após ativar as linhas no hwgui.hbp. veja se realmente foi gerada uma nova compilação da HWGUI. Se for o caso, apague a compilação anterior (bibliotecas na pasta lib e pasta oculta .hbmk).