Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting WinHttpRequest response to application code
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01686154
Message ID:
01686155
Views:
50
Hi,

You can use STRCONV("utf8string",9, 1257, 1)

MartinaJ

>WinHttpRequest is used to import bank statement from Nordiget.com containing characters from Windows-1257 code page. For unknown reason, FoxPro does replaces accented chartacters with ? signs. To fix this, COMPROP(WinHttpReq ,"UTF8",1) is added:
>
>
      WinHttpReq = CREATEOBJECT("WinHttp.WinHttpRequest.5.1")
>      WinHttpReq.Open("GET", "https://ob.nordigen.com/api/v2/accounts/11111-22222-333333-4444-/transactions/", .f.)
>      WinHttpReq.setrequestheader('accept', 'application/json')
>      WinHttpReq.setrequestheader('Authorization', "Bearer afde554a5sd45a45as4")
>      WinHttpReq.Send()
>      * If this is removed, acented characters appear as single ? signs:
>      COMPROP(WinHttpReq ,"UTF8",1)
>
>
>Response WinHttpReq.ResponseText contains accented characters represented by 4 bytes. First 3 are same but fourth is different. Those characters are converted by code using
>
>
>    Function NordigetConvert(cStr)
>    cstr = strt( cStr, CHR(0xc3)+CHR(0x83)+ CHR(0xc2)+CHR(0x9c) , 'Ü' ) 
>    cstr = strt( cStr, CHR(0xc3)+CHR(0x83)+ CHR(0xc2)+CHR(0xBC) , 'ü' ) 
>    cstr = strt( cStr, CHR(0xc3)+CHR(0x83)+ CHR(0xc2)+CHR(0x84) , 'Ä' ) 
>    cstr = strt( cStr, CHR(0xc3)+CHR(0x83)+ CHR(0xc2)+CHR(0xB6) , 'ö' ) 
>    return cStr
>
>
>This converts only ÜüÄö. There are much more characters to convert.
>How to force FoxPro to perform this conversion automatically?
>Or can some FoxPro strconv() or other function or WinAPI call used to preform this conversion?
>
>Posted also in https://stackoverflow.com/questions/75396853/how-to-import-unicode-data-from-winhttpreq
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform