Problem with GET and URL with Spanish words

Dear all, good evening,
I have a problem with HTTPSecureSocket, method GET, in detail:
I have to get a word translation from Google Translator API but when I use an URL with Spanish words the GET method failed, for instance, if I want to translate the word ‘maana’ I get the word ‘ma???ana’. I have used EncodeURLComponent but nothing, it doesn’t work.

Please, Can you help me?
Thanks in advance.
Best regards,
Stefano

Can you post the code you’re trying so we can look at it?

@Tim Parnell of course, the code is the following:

  dim orig_word as String = "mañana"
  dim word as String = EncodeURLComponent(orig_word)
  dim url as String = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=" + word
  url = ConvertEncoding(url, encodings.utf8)
  
  Dim socket1 As New HTTPSecureSocket
  socket1.Yield = True
  socket1.Secure = True
  Dim dataStr As String = socket1.Get(url, 30)
  socket1.Close
  dataStr = ConvertEncoding(dataStr, Encodings.UTF8)
  system.debuglog dataStr

Here the output:

[[["mañana","mañana",null,null,0]],null,"en",null,null,null,0,null,[["en"],null,[0],["en"]]]

I also try to remove url = ConvertEncoding(url, encodings.utf8) but I get the same result.

Thank you very much

Hi Stefano,

Did you tried to assign the text encoding (probably UTF-8) to the returned string from the Get method?

dataStr = dataStr.defineEncoding( encodings.UTF-8 )

Javier

Hi @Javier Menéndez thank you for your reply but my problem is about the url and not about the returned string, in detail, Google’s server doesn’t recognize the word which I send it and it sends me a wrong translation, I think the problem is the GET method because I use EncodeURLComponent() but I don’t know why the server receives a wrong url.

It works for me if I change the ConnectionType to TLSv1 or higher.

socket1.ConnectionType = HTTPSecureSocket.TLSv1