diff --git a/www/index.php b/www/index.php
index 3e812ceccf4da9b117d6ad253b9fe31a6eaf89b0..d73b6ae1c58b2805cf2d6c0cca519e34de28b372 100644
--- a/www/index.php
+++ b/www/index.php
@@ -40,7 +40,7 @@ if (isset($_GET['u'])
     
     if (isset($_GET['cx'])) {
         // Use their custom search engine instead of the linked one.
-        $context = '"'.htmlentities($_GET['cx']).'"';
+        $context = '"'.htmlentities($_GET['cx'], ENT_QUOTES).'"';
     } else {
         // Auto-build a custom search engine
         $context = '{crefUrl :"http://www1.unl.edu/search/linkedcse/?u='.$_GET['u'].'"}';