unix2dos

unix2dos

Postby Otto » Sat May 01, 2021 9:25 pm

Hello frieds,

I see this string in FWLOG.
cVData = E "button <br> \ r \ n reset <br> \ r \ n submit

I think it's a UNIX format. How can you convert this string to DOS?

As a workaround I am writing to the FWLOG file and then read the data from there. But I am sure there is a better way.

Is there a conversation function.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6342
Joined: Fri Oct 07, 2005 7:07 pm

Re: unix2dos

Postby Otto » Sun May 02, 2021 8:10 am

Hello,
I forgot to post my workaround,
a funny one but working.
Best regards,
Otto



Code: Select all  Expand view  RUN

fwlog cLine
cDosLine :=    unix2dos()

function unix2dos
    local chtmlfile
    local nAt := 0
    local cTmp := ""
   
    chtmlfile :=memoread( "readhtm.log" )
    ferase("readhtm.log")
    chtmlfile :=  STRTRAN( chtmlfile, '\r\n' , '' )
    chtmlfile :=  STRTRAN( chtmlfile, 'E"' , ' "' )
    memowrit("readhtm.txt",chtmlfile)
    cTmp := memoread( "readhtm.txt" )
    nAt := AT( '"', cTmp )
    cTmp := substr(cTmp , nAt+1 )  
    cTmp := ALLTRIM( left( cTmp, (len(cTmp)-4 ) ) )

return( cTmp  )
//----------------------------------------------------------------------------//
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6342
Joined: Fri Oct 07, 2005 7:07 pm

Re: unix2dos

Postby ADutheil » Sun May 02, 2021 12:20 pm

My function is
Code: Select all  Expand view  RUN
FUNCTION Unix2Win( cArqu )
LOCAL cBuff := ""
LOCAL cSaid := "DoUnix.txt"
LOCAL nEntr
LOCAL nSaid
LOCAL lRetu := .T.

BEGIN SEQUENCE
    IF ( nEntr:= fOpen( cArqu ) ) < 1
        msgStop( "IMPOSSÍVEL ABRIR: " + cArqu, msg_atencao )
        lRetu := .F.
        BREAK
    ENDIF
    IF (nSaid:= fCreate( cSaid ) ) < 1
        msgStop( "IMPOSSÍVEL CRIAR: " + cSaid, msg_atencao )
        lRetu := .F.
        fClose( nEntr )
        BREAK
    ENDIF
    WHILE hb_fReadLine( nEntr, @cBuff, chr(10) ) == 0
        fWrite( nSaid, cBuff + hb_OSNewLine() )
    ENDDO
    IF len( cBuff ) > 0
        fWrite( nSaid, cBuff + hb_OSNewLIne() )
    ENDIF
    fClose( nSaid )
    fClose( nEntr )
END SEQUENCE
RETURN ( lRetu )
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: unix2dos

Postby Antonio Linares » Sun May 02, 2021 2:13 pm

Dear Otto,

\ r \ n is Chr( 13 ) + Chr( 10 ), in FWH we have a define for it: CRLF

<br> is html code, and it seems so for button and submit

how do you create such line ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: unix2dos

Postby Otto » Sun May 02, 2021 4:47 pm

Dear Antonio,
Many thanks for your response. I read the attributes and event attributes of all tags from W3Schools.com. Some attributes then return these strings.
You can only see in FWLOG that E "and \ r \ n are still there.
I can't see the E "either when I scan the characters one by one.
The workaround works, and I now have the entire TAGLIST in a DBF file.

Best regards,
Otto

Image

Image
Image
Image
Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6342
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 34 guests