PT850 para ISO Acentuaçao

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

Avatar do usuário
Alexandre Silva
Usuário Nível 3
Usuário Nível 3
Mensagens: 376
Registrado em: 26 Mar 2007 00:16
Localização: Itapema - SC

PT850 para ISO Acentuaçao

Mensagem por Alexandre Silva »

Pessoal
Tem alguma função, ou programa na unha para converter dados que estão na codepage PT850 para ISO
pois se for em ISO consigo colocar no XML as acentuacoes. (seria para XML de NF de Serviço Betha que usa assim)


<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
* Clipper 5.2e/Gaspro 4.0 /CDX/Blinker 7.0 Harbour 3.2 Console Hbmk2
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

PT850 para ISO Acentuaçao

Mensagem por JoséQuintas »

Pois é, eu avisei.

Tem função no Harbour pra isso, pra converter codepage.
Não lembro agora quais são, porque nunca usei.
Talvez hbmk2 -find codepage
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
Poka
Usuário Nível 4
Usuário Nível 4
Mensagens: 563
Registrado em: 25 Out 2004 21:26
Localização: Leme/SP

PT850 para ISO Acentuaçao

Mensagem por Poka »

Bom dia

Com o tempo fui anotando algumas coisas, veja se ajuda.


Código: Selecionar todos

   cTexto := StrTran( cTexto, "A‡", "C" )
   cTexto := StrTran( cTexto, "Aƒ", "A" )
   cTexto := StrTran( cTexto, chr(135), "C" )
   // acento agudo
   cTexto := StrTran( cTexto, "á", "a" )
   cTexto := StrTran( cTexto, "é", "e" )
   cTexto := StrTran( cTexto, "í", "i" )
   cTexto := StrTran( cTexto, "ó", "o" )
   cTexto := StrTran( cTexto, "ú", "u" )
   cTexto := StrTran( cTexto, "Á", "A" )
   cTexto := StrTran( cTexto, "É", "E" )
   cTexto := StrTran( cTexto, "Í", "I" )
   cTexto := StrTran( cTexto, "Ó", "O" )
   cTexto := StrTran( cTexto, "Ú", "U" )

   // acento circunflexo
   cTexto := StrTran( cTexto, "â", "a" )
   cTexto := StrTran( cTexto, "ê", "e" )
   cTexto := StrTran( cTexto, "î", "i" )
   cTexto := StrTran( cTexto, "ô", "o" )
   cTexto := StrTran( cTexto, "û", "u" )
   cTexto := StrTran( cTexto, "Â", "A" )
   cTexto := StrTran( cTexto, "Ê", "E" )
   cTexto := StrTran( cTexto, "Î", "I" )
   cTexto := StrTran( cTexto, "Ô", "O" )
   cTexto := StrTran( cTexto, "Û", "U" )

   // til
   cTexto := StrTran( cTexto, "ã", "a" )
   cTexto := StrTran( cTexto, "õ", "o" )
   cTexto := StrTran( cTexto, "Ã", "A" )
   cTexto := StrTran( cTexto, "Õ", "O" )

   // ce-cedilha
   cTexto := StrTran( cTexto, "ç", "c" )
   cTexto := StrTran( cTexto, "Ç", "C" )

   // trema
   cTexto := StrTran( cTexto, "ü", "u" )
   cTexto := StrTran( cTexto, "Ü", "U" )
   // crase
   cTexto := StrTran( cTexto, "à", "a" )
   cTexto := StrTran( cTexto, "è", "e" )
   cTexto := StrTran( cTexto, "ì", "i" )
   cTexto := StrTran( cTexto, "ò", "o" )
   cTexto := StrTran( cTexto, "ù", "u" )
   cTexto := StrTran( cTexto, "À", "A" )
   cTexto := StrTran( cTexto, "È", "E" )
   cTexto := StrTran( cTexto, "Ì", "I" )
   cTexto := StrTran( cTexto, "Ò", "O" )
   cTexto := StrTran( cTexto, "Ù", "U" )
   cTexto := StrTran( cTexto, "A‰", "E" )
			//
  cTexto := StrTran( cTexto, "'", " " )
  cTexto := StrTran( cTexto, "´", " " )
  cTexto := StrTran( cTexto, "´", " " )
  //
  cTexto := StrTran( cTexto, "A§A£", "ÇÃ" )
  cTexto := StrTran( cTexto, "A£", "Ã" )
  cTexto := StrTran( cTexto, "A©", "É" )
  cTexto := StrTran( cTexto, "A­", "Í" )
  cTexto := StrTran( cTexto, "A¡", "Á" )
  cTexto := StrTran( cTexto, "A³", "Ó" )
  cTexto := StrTran( cTexto, "A§", "Ç" )
  *--------------------------------
  *---pego mais do clipper on line
  *-----------------------------------
   
   // acento agudo
   cTexto := StrTran( cTexto, "á", "a" )
   cTexto := StrTran( cTexto, "é", "e" )
   cTexto := StrTran( cTexto, "í", "i" )
   cTexto := StrTran( cTexto, "ó", "o" )
   cTexto := StrTran( cTexto, "ú", "u" )
   cTexto := StrTran( cTexto, "Á", "A" )
   cTexto := StrTran( cTexto, "É", "E" )
   cTexto := StrTran( cTexto, "Í", "I" )
   cTexto := StrTran( cTexto, "Ó", "O" )
   cTexto := StrTran( cTexto, "Ú", "U" )

//   cTexto := StrTran( cTexto, " ", "a" )

   cTexto := StrTran( cTexto, "‚", "a" )
   cTexto := StrTran( cTexto, "¡", "a" )
   cTexto := StrTran( cTexto, "¢", "a" )
   cTexto := StrTran( cTexto, "£", "a" )
   cTexto := StrTran( cTexto, "µ", "A" )
   cTexto := StrTran( cTexto, "", "E" )
   cTexto := StrTran( cTexto, "Ö", "I" )
   cTexto := StrTran( cTexto, "à", "O" )
   cTexto := StrTran( cTexto, "é", "U" )
   
   // acento circunflexo
   cTexto := StrTran( cTexto, "â", "a" )
   cTexto := StrTran( cTexto, "ê", "e" )
   cTexto := StrTran( cTexto, "î", "i" )
   cTexto := StrTran( cTexto, "ô", "o" )
   cTexto := StrTran( cTexto, "û", "u" )
   cTexto := StrTran( cTexto, "Â", "A" )
   cTexto := StrTran( cTexto, "Ê", "E" )
   cTexto := StrTran( cTexto, "Î", "I" )
   cTexto := StrTran( cTexto, "Ô", "O" )
   cTexto := StrTran( cTexto, "Û", "U" )
   cTexto := StrTran( cTexto, "¶", "A" )
   cTexto := StrTran( cTexto, "â", "O" )
   cTexto := StrTran( cTexto, "ƒ", "a" )
   cTexto := StrTran( cTexto, "“", "o" )
   
   // til
   cTexto := StrTran( cTexto, "ã", "a" )
   cTexto := StrTran( cTexto, "õ", "o" )
   cTexto := StrTran( cTexto, "Ã", "A" )
   cTexto := StrTran( cTexto, "Õ", "O" )
   cTexto := StrTran( cTexto, "Ç", "A" )
   cTexto := StrTran( cTexto, "å", "O" )
   cTexto := StrTran( cTexto, "Æ", "a" )
   cTexto := StrTran( cTexto, "ä", "o" )
   
   // ce-cedilha
   cTexto := StrTran( cTexto, "ç", "c" )
   cTexto := StrTran( cTexto, "Ç", "C" )
   cTexto := StrTran( cTexto, "€", "C" )
   cTexto := StrTran( cTexto, "‡", "c" )
   
   // trema
   cTexto := StrTran( cTexto, "ü", "u" )
   cTexto := StrTran( cTexto, "Ü", "U" )
   
   // crase
   cTexto := StrTran( cTexto, "à", "a" )
   cTexto := StrTran( cTexto, "è", "e" )
   cTexto := StrTran( cTexto, "ì", "i" )
   cTexto := StrTran( cTexto, "ò", "o" )
   cTexto := StrTran( cTexto, "ù", "u" )
   cTexto := StrTran( cTexto, "À", "A" )
   cTexto := StrTran( cTexto, "È", "E" )
   cTexto := StrTran( cTexto, "Ì", "I" )
   cTexto := StrTran( cTexto, "Ò", "O" )
   cTexto := StrTran( cTexto, "Ù", "U" )
   
   cTexto := StrTran( cTexto, "¶", "A" )
   cTexto := StrTran( cTexto, "â", "O" )
   cTexto := StrTran( cTexto, "ƒ", "a" )
   cTexto := StrTran( cTexto, "“", "o" )
Poka
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

PT850 para ISO Acentuaçao

Mensagem por JoséQuintas »

HB_TRANSLATE( <cSrcText>, [<cPageFrom>], [<cPageTo>] ) --> cDstText
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
Alexandre Silva
Usuário Nível 3
Usuário Nível 3
Mensagens: 376
Registrado em: 26 Mar 2007 00:16
Localização: Itapema - SC

PT850 para ISO Acentuaçao

Mensagem por Alexandre Silva »

Opa
Deu certo
com a ajuda desse include
#include "hbextcdp.ch"
vtxt:=HB_TRANSLATE(alltrim(vtxt),"PT850","PTISO" )


Agora ao fazer o xml para Betha uso
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>

Quanto ao Poka, no caso ele está tirando a acentuaçao, eu tambem faço isso para trabalhar com UTF-8
vou ver agora com acentuacao,
Obrigado a todos
Poka escreveu:Bom dia

Com o tempo fui anotando algumas coisas, veja se ajuda.


Código: Selecionar todos

   cTexto := StrTran( cTexto, "A‡", "C" )
   cTexto := StrTran( cTexto, "Aƒ", "A" )
   cTexto := StrTran( cTexto, chr(135), "C" )
   // acento agudo
   cTexto := StrTran( cTexto, "á", "a" )
   cTexto := StrTran( cTexto, "é", "e" )
   cTexto := StrTran( cTexto, "í", "i" )
   cTexto := StrTran( cTexto, "ó", "o" )
   cTexto := StrTran( cTexto, "ú", "u" )
   cTexto := StrTran( cTexto, "Á", "A" )
   cTexto := StrTran( cTexto, "É", "E" )
   cTexto := StrTran( cTexto, "Í", "I" )
   cTexto := StrTran( cTexto, "Ó", "O" )
   cTexto := StrTran( cTexto, "Ú", "U" )

   // acento circunflexo
   cTexto := StrTran( cTexto, "â", "a" )
   cTexto := StrTran( cTexto, "ê", "e" )
   cTexto := StrTran( cTexto, "î", "i" )
   cTexto := StrTran( cTexto, "ô", "o" )
   cTexto := StrTran( cTexto, "û", "u" )
   cTexto := StrTran( cTexto, "Â", "A" )
   cTexto := StrTran( cTexto, "Ê", "E" )
   cTexto := StrTran( cTexto, "Î", "I" )
   cTexto := StrTran( cTexto, "Ô", "O" )
   cTexto := StrTran( cTexto, "Û", "U" )

   // til
   cTexto := StrTran( cTexto, "ã", "a" )
   cTexto := StrTran( cTexto, "õ", "o" )
   cTexto := StrTran( cTexto, "Ã", "A" )
   cTexto := StrTran( cTexto, "Õ", "O" )

   // ce-cedilha
   cTexto := StrTran( cTexto, "ç", "c" )
   cTexto := StrTran( cTexto, "Ç", "C" )

   // trema
   cTexto := StrTran( cTexto, "ü", "u" )
   cTexto := StrTran( cTexto, "Ü", "U" )
   // crase
   cTexto := StrTran( cTexto, "à", "a" )
   cTexto := StrTran( cTexto, "è", "e" )
   cTexto := StrTran( cTexto, "ì", "i" )
   cTexto := StrTran( cTexto, "ò", "o" )
   cTexto := StrTran( cTexto, "ù", "u" )
   cTexto := StrTran( cTexto, "À", "A" )
   cTexto := StrTran( cTexto, "È", "E" )
   cTexto := StrTran( cTexto, "Ì", "I" )
   cTexto := StrTran( cTexto, "Ò", "O" )
   cTexto := StrTran( cTexto, "Ù", "U" )
   cTexto := StrTran( cTexto, "A‰", "E" )
			//
  cTexto := StrTran( cTexto, "'", " " )
  cTexto := StrTran( cTexto, "´", " " )
  cTexto := StrTran( cTexto, "´", " " )
  //
  cTexto := StrTran( cTexto, "A§A£", "ÇÃ" )
  cTexto := StrTran( cTexto, "A£", "Ã" )
  cTexto := StrTran( cTexto, "A©", "É" )
  cTexto := StrTran( cTexto, "A­", "Í" )
  cTexto := StrTran( cTexto, "A¡", "Á" )
  cTexto := StrTran( cTexto, "A³", "Ó" )
  cTexto := StrTran( cTexto, "A§", "Ç" )
  *--------------------------------
  *---pego mais do clipper on line
  *-----------------------------------
   
   // acento agudo
   cTexto := StrTran( cTexto, "á", "a" )
   cTexto := StrTran( cTexto, "é", "e" )
   cTexto := StrTran( cTexto, "í", "i" )
   cTexto := StrTran( cTexto, "ó", "o" )
   cTexto := StrTran( cTexto, "ú", "u" )
   cTexto := StrTran( cTexto, "Á", "A" )
   cTexto := StrTran( cTexto, "É", "E" )
   cTexto := StrTran( cTexto, "Í", "I" )
   cTexto := StrTran( cTexto, "Ó", "O" )
   cTexto := StrTran( cTexto, "Ú", "U" )

//   cTexto := StrTran( cTexto, " ", "a" )

   cTexto := StrTran( cTexto, "‚", "a" )
   cTexto := StrTran( cTexto, "¡", "a" )
   cTexto := StrTran( cTexto, "¢", "a" )
   cTexto := StrTran( cTexto, "£", "a" )
   cTexto := StrTran( cTexto, "µ", "A" )
   cTexto := StrTran( cTexto, "", "E" )
   cTexto := StrTran( cTexto, "Ö", "I" )
   cTexto := StrTran( cTexto, "à", "O" )
   cTexto := StrTran( cTexto, "é", "U" )
   
   // acento circunflexo
   cTexto := StrTran( cTexto, "â", "a" )
   cTexto := StrTran( cTexto, "ê", "e" )
   cTexto := StrTran( cTexto, "î", "i" )
   cTexto := StrTran( cTexto, "ô", "o" )
   cTexto := StrTran( cTexto, "û", "u" )
   cTexto := StrTran( cTexto, "Â", "A" )
   cTexto := StrTran( cTexto, "Ê", "E" )
   cTexto := StrTran( cTexto, "Î", "I" )
   cTexto := StrTran( cTexto, "Ô", "O" )
   cTexto := StrTran( cTexto, "Û", "U" )
   cTexto := StrTran( cTexto, "¶", "A" )
   cTexto := StrTran( cTexto, "â", "O" )
   cTexto := StrTran( cTexto, "ƒ", "a" )
   cTexto := StrTran( cTexto, "“", "o" )
   
   // til
   cTexto := StrTran( cTexto, "ã", "a" )
   cTexto := StrTran( cTexto, "õ", "o" )
   cTexto := StrTran( cTexto, "Ã", "A" )
   cTexto := StrTran( cTexto, "Õ", "O" )
   cTexto := StrTran( cTexto, "Ç", "A" )
   cTexto := StrTran( cTexto, "å", "O" )
   cTexto := StrTran( cTexto, "Æ", "a" )
   cTexto := StrTran( cTexto, "ä", "o" )
   
   // ce-cedilha
   cTexto := StrTran( cTexto, "ç", "c" )
   cTexto := StrTran( cTexto, "Ç", "C" )
   cTexto := StrTran( cTexto, "€", "C" )
   cTexto := StrTran( cTexto, "‡", "c" )
   
   // trema
   cTexto := StrTran( cTexto, "ü", "u" )
   cTexto := StrTran( cTexto, "Ü", "U" )
   
   // crase
   cTexto := StrTran( cTexto, "à", "a" )
   cTexto := StrTran( cTexto, "è", "e" )
   cTexto := StrTran( cTexto, "ì", "i" )
   cTexto := StrTran( cTexto, "ò", "o" )
   cTexto := StrTran( cTexto, "ù", "u" )
   cTexto := StrTran( cTexto, "À", "A" )
   cTexto := StrTran( cTexto, "È", "E" )
   cTexto := StrTran( cTexto, "Ì", "I" )
   cTexto := StrTran( cTexto, "Ò", "O" )
   cTexto := StrTran( cTexto, "Ù", "U" )
   
   cTexto := StrTran( cTexto, "¶", "A" )
   cTexto := StrTran( cTexto, "â", "O" )
   cTexto := StrTran( cTexto, "ƒ", "a" )
   cTexto := StrTran( cTexto, "“", "o" )
Poka
* Clipper 5.2e/Gaspro 4.0 /CDX/Blinker 7.0 Harbour 3.2 Console Hbmk2
Responder