3

I am requesting results from this API: http://mlrs.research.um.edu.mt/resources/gabra-api/

Everything works fine except when I introduce Maltese characters (which are UTF-8).

If I manually request the data using the following URLs, the return is correct. http://mlrs.research.um.edu.mt/resources/gabra-api/lexemes/search?s=għar

...search?s=ċar (can't post more than two links yet.)

When using the following code, the return is blank.

{"results":[],"query":{"page":1,"page_size":20,"result_count":0,"term":"g?ar","search_lemma":true,"search_wordforms":true,"search_gloss":true,"pending":false,"pos":null,"source":null}}

{"results":[],"query":{"page":1,"page_size":20,"result_count":0,"term":"?ar","search_lemma":true,"search_wordforms":true,"search_gloss":true,"pending":false,"pos":null,"source":null}}

Note ? replacing ħ and ċ characters - that's only because I copied these from the immediate window.

This is the code I am using to make the requests:

Public Function GetWebSource(ByRef Url As String) As String
  Dim xml As IXMLHTTPRequest
  On Error Resume Next
  Set xml = CreateObject("Microsoft.XMLHTTP")
  With xml
    .Open "GET", Url, False
    .send
    GetWebSource = .responseText
  End With
  Set xml = Nothing
End Function

Because VBA IDE does not support these characters, tests will need to be done from a form field.

Any help, much appreciated.

Thanks in advance.

Stephen

1 Answer 1

1

The URL contains some non ASCII characters, so you'll have to encode them beforehand:

Set xhr = CreateObject("Microsoft.XMLHTTP")
xhr.Open "GET", "http://mlrs.research.um.edu.mt/resources/gabra-api/lexemes/search?s=g%C4%A7ar", False
xhr.Send
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.