Carlos, it's a bit tricky in VFP6.
First, you probably should use .responseBody instead, because there is no transformation of what is sent by the server (beware, it's a byte array so you need to address it as an array, not as a string).
Then, you need to convert the UTF-8 to ISO-Latin-1. Since you don't have anything native in VFP6 for that, you must build your own conversion. If you're only needing to take care of the basic Latin UNICODE block (that's what is required for Portuguese), then this will do:
oHTTP = CREATEOBJECT("WinHttp.WinHttpRequest.5.1")
WITH oHTTP
.Open("GET", m.lcURL, .f.)
ENDWITH
oHTTP.send()
m.the_name_array = oHTTP.responseBody
m.the_name = ""
m.ind = 1
do while m.ind < alen(m.the_name_array)
m.ch = m.the_name_array[m.ind]
do case
case chr(m.ch) == 'Â'
m.ind = m.ind + 1
m.ch = m.the_name_array[m.ind]
case chr(m.ch) == 'Ã'
m.ind = m.ind + 1
m.ch = m.the_name_array[m.ind] + 64
endcase
the_name = the_name + chr(m.ch)
m.ind = m.ind + 1
enddo
? m.the_name
>Good Morning,
>In VFP6,
>I'm trying to get the name 'CORNÉLIO' with the following code, but it's returning 'CORNÃ?LIO'.
>what parameter should I pass to http to not convert the value
>Can someone explain to me how to do it.
>thank you in advance
>
>oHTTP = CREATEOBJECT("WinHttp.WinHttpRequest.5.1")
>WITH oHTTP
>.Open("GET", lcURL, lcAsyncMode)
>.setRequestHeader('Accept', 'application/json')
>ENDWITH
>oHTTP.send()
>the_name = oHTTP.responseText
----------------------------------
António Tavares Lopes