diff --git a/includes/context.inc b/includes/context.inc
index 8b6d603..a532f65 100644
--- a/includes/context.inc
+++ b/includes/context.inc
@@ -676,14 +676,19 @@ function ctools_context_keyword_substitute($string, $keywords, $contexts, $conve
         }
       }
 
-      if (empty($context_keywords[$context]) || !empty($context_keywords[$context]->empty)) {
-        $keywords['%' . $keyword] = '';
-      }
-      else if (!empty($converter)) {
-        $keywords['%' . $keyword] = ctools_context_convert_context($context_keywords[$context], $converter, $converter_options);
+      if (!isset($context_keywords[$context])) {
+        $keywords['%' . $keyword] = '%' . $keyword;
       }
       else {
-        $keywords['%' . $keyword] = $context_keywords[$keyword]->title;
+        if (empty($context_keywords[$context]) || !empty($context_keywords[$context]->empty)) {
+          $keywords['%' . $keyword] = '';
+        }
+        else if (!empty($converter)) {
+          $keywords['%' . $keyword] = ctools_context_convert_context($context_keywords[$context], $converter, $converter_options);
+        }
+        else {
+          $keywords['%' . $keyword] = $context_keywords[$keyword]->title;
+        }
       }
     }
   }
diff --git a/tests/context.test b/tests/context.test
index bdf14e3..08cd5af 100644
--- a/tests/context.test
+++ b/tests/context.test
@@ -51,6 +51,30 @@ public function testKeywordsSubstitution() {
         "%{$node->title}",
         t('Keyword after escaped and unescaped percent sign has been replaced.'),
       ),
+      '%%foo:bar' => array(
+        "%foo:bar",
+        t('Non-existant context ignored.'),
+      ),
+      'There was about 20%-30% difference in price.' => array(
+        'There was about 20%-30% difference in price.',
+        t('Non-keyword percent sign left untouched.'),
+      ),
+      'href="my%20file%2dname.pdf"' => array(
+        'href="my%20file%2dname.pdf"',
+        t('HTTP URL escape left untouched.'),
+      ),
+      'href="my%a0file%fdname.pdf"' => array(
+        'href="my%a0file%fdname.pdf"',
+        t('HTTP URL escape (high-chars) left untouched.'),
+      ),
+      '<a href="http://www.example.com/here%20is%20a%20pdf.pdf">Click here!</a>' => array(
+        '<a href="http://www.example.com/here%20is%20a%20pdf.pdf">Click here!</a>',
+        t('HTTP URL escape percent sign left untouched in HTML.'),
+      ),
+      'SELECT * FROM {table} WHERE field = "%s"' => array(
+        'SELECT * FROM {table} WHERE field = "%s"',
+        t('SQL percent sign left untouched.'),
+      ),
     );
     foreach ($checks as $string => $expectations) {
       list($expected_result, $message) = $expectations;
