Fix crash when searching for non-ASCII

This commit is contained in:
James Magahern
2020-11-10 16:57:56 -06:00
parent abcd91fb99
commit 088b1eb43e

View File

@@ -548,7 +548,10 @@ class BrowserViewController: UIViewController, WKNavigationDelegate, WKUIDelegat
tab.beginLoadingURL(url)
} else {
// Assume google search
let queryString = text.replacingOccurrences(of: " ", with: "+")
let queryString = text
.replacingOccurrences(of: " ", with: "+")
.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
let searchURL = URL(string: "https://google.com/search?q=\(queryString)&gbv=1")! // gbv=1: no JS
tab.beginLoadingURL(searchURL)
}