Avatar of João serras-pereira
João serras-pereira
Flag for Portugal

asked on 

character set on REST interface

This Question is a follow-up of a previous question with the title "web browser for the REST interface" (previously we could issue follow-up questions, but now I can't find how to do it).

It was sorted and it works (almost) perfectly, using Jim's approach.
Now, my code is:

Public Function sendSMS(strApiKey As String, strApiSecret As String, strTarget As String, strText As String) As String

    strFrom = "myFib"

    Dim strPostURL As String
    Dim arrResponse
    Dim objRequest As New MSXML2.XMLHTTP
    Dim strAnswer As String
    strPostURL = "https://rest.nexmo.com/sms/json"
    strPostURL = strPostURL & "?api_key="
    strPostURL = strPostURL & strApiKey
    strPostURL = strPostURL & "&api_secret=" & strApiSecret
    strPostURL = strPostURL & "&from=" & "myFM"
    strPostURL = strPostURL & "&type=unicode"
    strPostURL = strPostURL & "&to=" & strTarget
    strPostURL = strPostURL & "&text=" & strText
    MsgBox strPostURL

    On Error GoTo Error_Handler

    ' Default to false in case anything goes wrong.
    sendSMS = ""
    ' We use xmlHTTP to submit the input values and record the response
    objRequest.Open "POST", strPostURL, False
    arrResponse = objRequest.responseText
    sendSMS = arrResponse
    Exit Function

    On Error Resume Next
    Set objRequest = Nothing
    Exit Function

      MsgBox Err.Description, _
        "ERROR " & Err.Number

    Resume Exit_Handler

End Function

Open in new window

The problem is that it does not accept accented characters (or Unicode)
As per NEXMO's support, I quote:
I've done a further check and I noticed the message seems garbled before reaching Nexmo. I'm wondering if this is something related to your system environment, as I've performed a test with our test numbers and it is working fine.

Could you try a simple debug by using a different tool(maybe POSTMAN or just simply a curl command) to re-send the SMS request again and observe the result?

Can anyone help me?

Avatar of undefined
Last Comment
João serras-pereira

8/22/2022 - Mon