diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index 7db6715b49..47e116cd1a 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -76,7 +76,9 @@ _base_js_escapes = ( ('&', r'\x26'), ('=', r'\x3D'), ('-', r'\x2D'), - (';', r'\x3B') + (';', r'\x3B'), + (u'\u2028', r'\u2028'), + (u'\u2029', r'\u2029') ) # Escape every ASCII character with a value less than 32. diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py index 027fcbba7d..4343586c48 100644 --- a/tests/regressiontests/defaultfilters/tests.py +++ b/tests/regressiontests/defaultfilters/tests.py @@ -83,6 +83,9 @@ u'and lots of whitespace: \\x0D\\x0A\\x09\\x0B\\x0C\\x08' >>> escapejs(ur'') u'\\x3Cscript\\x3Eand this\\x3C/script\\x3E' +>>> escapejs(u'paragraph separator:\u2029and line separator:\u2028') +u'paragraph separator:\\u2029and line separator:\\u2028' + >>> fix_ampersands(u'Jack & Jill & Jeroboam') u'Jack & Jill & Jeroboam'