diff --git a/django/utils/text.py b/django/utils/text.py
index d277cee56b4..9e0afad47b5 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -343,7 +343,7 @@ def javascript_quote(s, quote_double_quotes=False):
s = s.replace('', '<\\/')
if quote_double_quotes:
s = s.replace('"', '"')
- return str(ustring_re.sub(fix, s))
+ return ustring_re.sub(fix, s)
javascript_quote = allow_lazy(javascript_quote, six.text_type)
# Expression to match some_token and some_token="with spaces" (and similarly
diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py
index bf547b62d25..4911cac908c 100644
--- a/tests/utils_tests/test_text.py
+++ b/tests/utils_tests/test_text.py
@@ -155,3 +155,8 @@ class TestUtilsText(SimpleTestCase):
self.assertEqual(text.javascript_quote(input), '"Text"')
self.assertEqual(text.javascript_quote(input, quote_double_quotes=True),
'"Text"')
+
+ def test_javascript_quote_unicode(self):
+ input = ""
+ output = r"