FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Memoedit to HTML by API connection
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Memoedit to HTML by API connection
Posted: Mon May 22, 2023 09:28 PM

I'm having issues that when I read a memo field where some ascii codes like CRLF,.. are used and I save them by API online,

The API is not saving data when there are special chars insite the text.

I tried some changing with strreplace, but there are always new items comming up.

Is there a general ALL conversion of special chars for this in a function (FW) ?

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Memoedit to HTML by API connection
Posted: Tue May 23, 2023 05:37 AM

Dear Marc,

What API do you refeer to ?

Could you please provide a small example ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Memoedit to HTML by API connection
Posted: Tue May 23, 2023 01:52 PM
Antonio,

I fill a string with keys needed by the API. Once I have filled the str the upload is done.
The problem I seem to have is that insite the memofield there a chars (codes) like CRLF, ENTER, and more format items. When I leave them out the upload is ok.
When I include the field and I think there are some codes inside like like CRLF ,... the upload is not correct.

I already change chars before include into the string, but I miss some of them. Is there a list of these items ? Is that the Unicode ??
Code (fw): Select all Collapse
     //  This is one of the items to be included.

     if lNew .or. at("MEMOTXT",cChanges) > 0
       cData = change_memotxt(alltrim(webshop->memotxt))
       cBuffer = cBuffer + '"introDescription":"'+cData+'",'  //  string building for later upload by API (jSon)
       cChanges = strtran(cChanges,"[MEMOTXT]","")
     endif

function change_memotxt(cData)
   cData = STRTRAN(cData, "m²", "m2")
   cData = STRTRAN(cData, '//', '<br>')
   cData = STRTRAN(cData, '|', '<br>')
   cData = STRTRAN(cData, '·', '')
   cData = STRTRAN(cData, 'Â', '')
   cData = STRTRAN(cData, 'ú', '')
   cData = STRTRAN(cData, 'ë', '&#235')
   cData = STRTRAN(cData, ';', ' ')
   cData = STRTRAN(cData, '"', '')
   cData = STRTRAN(cData, 'é', 'é') //    é
   cData = STRTRAN(cData, 'è', 'è')
   cData = STRTRAN(cData, '®', '')
   //cData = StrTran(cData, CRLF , "<br>")

return cData
Marc Venken

Using: FWH 23.08 with Harbour

Continue the discussion