diff --git a/scss/_functions.scss b/scss/_functions.scss
index cc37c91f7286..ad0e7a6679ed 100644
--- a/scss/_functions.scss
+++ b/scss/_functions.scss
@@ -75,7 +75,12 @@
 @function escape-svg($string) {
   @if str-index($string, "data:image/svg+xml") {
     @each $char, $encoded in $escaped-characters {
-      $string: str-replace($string, $char, $encoded);
+      // Do not escape the url brackets
+      @if str-index($string, "url(") == 1 {
+        $string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}");
+      } @else {
+        $string: str-replace($string, $char, $encoded);
+      }
     }
   }
 
diff --git a/scss/_variables.scss b/scss/_variables.scss
index c34e2d1700ae..ef0f2125db14 100644
--- a/scss/_variables.scss
+++ b/scss/_variables.scss
@@ -208,6 +208,8 @@ $escaped-characters: (
   ("<","%3c"),
   (">","%3e"),
   ("#","%23"),
+  ("(","%28"),
+  (")","%29"),
 ) !default;
 
 // Options