chinese term causes a crash on web search

My app does a search for YouTube videos, but when a customer put a chinese search term in ( ??? ) it immediately crashes when hitting the search button.
The error i get is: “An exception of class Xojo.Core.InvalidArgumentException was not handled. The application must shut down.”

[code]dim s as string = textField1.text
s = s.replaceAll(" “,”+")
dim searchTerm as Text
searchTerm = s.toText

searchURL = “https://www.googleapis.com/youtube/v3/search?q=” + searchTerm // truncated the rest of the parameters for brevity
YTSocket1.Send(“GET”, searchURL)
// where YTSocket1 is a class
[/code]

You may need to urlencode the search term.

+1

http://documentation.xojo.com/api/text/encoding_text/encodeurlcomponent.html

thanks. I’ll look into that.

that worked - thanks!