From 088b1eb43e2f7dfb777d71ecffab93154add8a90 Mon Sep 17 00:00:00 2001 From: James Magahern Date: Tue, 10 Nov 2020 16:57:56 -0600 Subject: [PATCH] Fix crash when searching for non-ASCII --- App/Browser View/BrowserViewController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/App/Browser View/BrowserViewController.swift b/App/Browser View/BrowserViewController.swift index 4917f7a..8015c93 100644 --- a/App/Browser View/BrowserViewController.swift +++ b/App/Browser View/BrowserViewController.swift @@ -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) }