lailton.webmaster wrote:Try
HB_OemToAnsi( UTF8ToStr( cString ) )
Check it:
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=10986&hilit=utf8
Thanks Lailton but doesn't work. I think in give up.
lailton.webmaster wrote:Try
HB_OemToAnsi( UTF8ToStr( cString ) )
Check it:
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=10986&hilit=utf8
Wanderson,
provide a prg that i can compile to test it, and send for my mail.
#include "Fivewin.ch"
Function Main()
 cXML := StrTran( MemoRead( "retorno.xml" ), CRLF )
 xMotivo := GetStringFromXMl('<xMotivo>','</xMotivo>', cXML )
 MsgInfo(xMotivo)
Return Nil
Function GetStringFromXMl( cInicio, cFinal, cString )
Local nInicio:=At( cInicio, cString ) + Len( cInicio )
Local nFinal :=At( cFinal, cString ) - nInicio
Return Alltrim( Substr( cString, nInicio, nFinal ) )<retCancCTe xmlns="http://www.portalfiscal.inf.br/cte" versao="1.03">
<infCanc Id="CTe52110104395298000137570010000000841589634677">
<tpAmb>2</tpAmb>
<cUF>52</cUF>
<verAplic>RS20100226092505</verAplic>
<cStat>218</cStat>
<xMotivo>Rejeição: CT-e ja esta cancelada na base de dados da SEFAZ</xMotivo>
<chCTe>52110104395298000137570010000000841589634677</chCTe>
<dhRecbto>2011-01-12T09:59:15</dhRecbto>
<nProt />
</infCanc>
</retCancCTe>
Lailton i test your code and runs ok but the problem is not in code but in xml. Try with this xml (this is a sefaz file return).
http://rapidshare.com/files/442284031/Retorno.rar
Thanks.
I´ll see. ![]()
Thank you Lailton works great.
Just one more observation:
cString := StrTran( MemoRead( "Retorno.xml" ), CRLF )
Some times cString returns empty and Retorno.xml is not empty.
In this case a try again cString := StrTran( MemoRead( "Retorno.xml" ), CRLF ) and returns ok.
It's happen to you?
Thanks.
I try this and works well.
For x = 1 to 100
cXML := StrTran( MemoRead( Arq_Erro ), CRLF )
If Empty(cXML)
inkey(0.1)
loop
Endif
cXML := TrataRetornoXml(cXML)
xMotivo := GetStringFromXMl('<xMotivo>','</xMotivo>', cXML )
Exit
Next x
Thanks.
cXml := ""
Do while Empty( cXml )
  cXML := TrataRetornoXml(StrTran( MemoRead( Arq_Erro ), CRLF ))
  SysRefresh()
EndDo
xMotivo := GetStringFromXMl('<xMotivo>','</xMotivo>', cXML )