Página 1 de 1
Efeito colateral - HB_SetCodePage( "PT850" )
Enviado: 28 Nov 2018 13:06
por Carlos Susviela
No post
https://pctoledo.org/forum/viewto ... 45&t=19631 descobri a solução para o problema de acentuação que gerava erros na minha classe encripta, mas obtive um efeito colateral.
A solução foi inserir no meu código essas instruções abaixo:
Código: Selecionar todos
REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_PT850
HB_SetCodePage( "PT850" )
HB_LANGSELECT("PT")
O detalhe, ao aplicar essas instruções no meu sistema as telas do (
HMG 3.4.4 Unicode ) obtive erros de acentuação na GUI do sistema, to meio perdido, vou continuar pesquisando ...
O problema É COM CERTEZA NO CODEPAGE, pois com apenas esses comandos já volto a ter os acentos normalmente

- Acentuação com erro
- W64-HMG-MariaDB.png (4.26 KiB) Exibido 1567 vezes
Efeito colateral - HB_SetCodePage( "PT850" )
Enviado: 28 Nov 2018 19:09
por Carlos Susviela
Eita que esse troço de UNICODE / UTF8 é complicado mas .. ta resolvido ...
Fica a dica o CODEPAGE default do HMG 3.4.4 é UTF8.
Testar com: msginfo( HB_SetCodePage() )
Umas pesquisas e encontrei essas funções:
hb_UTF8ToStr()
hb_StrToUTF8()
- HB_UCODE ( cUnicodeCharacter ) --> Return nCode / ASC
- HB_UCHAR ( nCode ) --> Return cUnicodeCharacter / CHR
hb_StrToUtf8( sData, sCodepageIN ) Translation sData of sCodepageIN in utf8
hb_Utf8ToStr( sData, sCodepageOUT ) Translation sData from utf8 to sCodepageOUT
hb_Utf8Len( sData ) This and the following functions are analogs of
hb_utf8Chr( n ) the standard string functions Len(),
hb_utf8Asc( sData ) Chr(), Asc (), etc., but for rows in a
hb_utf8Substr( sData, n1, n2 ) utf8 encoding. As it is known, in utf8
hb_utf8Left( sData, n1 ) one character may be encoded with more
hb_utf8Right( sData, n1 ) than one byte. These functions operate with
hb_utf8Stuff( sData, n1, n2, cNew ) the number of symbols rather than bytes.
hb_utf8Peek( sData, n1 )
hb_utf8Poke( sData, n1, n )
Efeito colateral - HB_SetCodePage( "PT850" )
Enviado: 29 Nov 2018 10:42
por sygecom
Carlos,
Tentou verificar a codificação do arquivo .PRG, o mesmo tem que está salvo como UTF8
Efeito colateral - HB_SetCodePage( "PT850" )
Enviado: 29 Nov 2018 22:44
por Carlos Susviela
Já resolvi, obrigado.
Fica a dica:
1) Os fontes tem que estar em UTF8
2) A HMG 3.4.4 Unicode usa a página de código UTF8 como default (então ai estava o erro ao setar PT850)
3) Você precisa tomar cuidado com as funções que tratam strings CHR / ASC entre outras ... elas tem correspondentes em Unicode - hb_utf8Chr( n ) / hb_utf8Asc()