Memoedit to HTML by API connection

Memoedit to HTML by API connection

Postby Marc Venken » Mon May 22, 2023 9: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Memoedit to HTML by API connection

Postby Antonio Linares » Tue May 23, 2023 5:37 am

Dear Marc,

What API do you refeer to ?

Could you please provide a small example ?
regards, saludos

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

Re: Memoedit to HTML by API connection

Postby Marc Venken » Tue May 23, 2023 1: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: Select all  Expand view

     //  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, 'é', '&eacute;') //    &#233;
   cData = STRTRAN(cData, 'è', '&#232;')
   cData = STRTRAN(cData, '®', '')
   //cData = StrTran(cData, CRLF , "<br>")

return cData

 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests