[SOLVED] 5.70 b2 HTTPInfo() character problem

Just starting out? Need help? Post your questions and find answers here.
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

[SOLVED] 5.70 b2 HTTPInfo() character problem

Post by infratec »

Hi,

HttpRequestMemory() allows not the direct access to the receive buffer.
We have to use:

Code: Select all

HTTPInfo(HTTPRequest, #PB_HTTP_Response)
The problem is, that when UTF8 was received, it doesn't respect this and returns garbage as Unicode.
I have not really a chance to convert this back in UTF8.

Code: Select all

InitNetwork()

HttpRequest = HTTPRequest(#PB_HTTP_Post, "https://www.ednt.de")
If HttpRequest
  Debug "StatusCode = "+ HTTPInfo(HTTPRequest, #PB_HTTP_ErrorCode)
  Response$ = HTTPInfo(HTTPRequest, #PB_HTTP_Response)
  
  Pos = FindString(Response$, ~"<a title=\"R")
  If Pos
    Debug Mid(Response$, Pos, FindString(Response$, "</a>", Pos) - Pos + 4)
    Debug "Should be: Rückruf"
  EndIf
  
  FinishHTTP(HttpRequest)
Else
  Debug "Failed"
EndIf
Bernd
Last edited by infratec on Fri Oct 19, 2018 8:18 am, edited 2 times in total.
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: HTTPInfo character problem

Post by Marc56us »

Code: Select all

Response$ = HTTPInfo(HTTPRequest, #PB_HTTP_Response)

<a title="Rückruf anfordern" href="rueckruf-button">Fordern Sie einen Rückruf von uns an.</a>
:idea: , #PB_UTF8)

Code: Select all

Response$ = HTTPInfo(HTTPRequest, #PB_HTTP_Response, #PB_UTF8)

<a title="Rückruf anfordern" href="rueckruf-button">Fordern Sie einen Rückruf von uns an.</a>
:wink:
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: [SOLVED] 5.70 b2 HTTPInfo() character problem

Post by infratec »

You're right :!:

I only tried #PB_HTTP_Response|#PB_UTF8

:wink:
Post Reply