Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #10675 -- Added unicode paragraph and line-sep handling to esca…

…pejs.

There were a couple of line breaking Unicode characters (\u2028 and
\u2029) that cause Javascript errors, at least in Firefox, if not
escaped. So now we do so. Based on a patch from rleland.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10543 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8931d8d68872f3b0742dafe02f4ab39d610c82e3 1 parent 499a8ac
Malcolm Tredinnick authored April 12, 2009
4  django/template/defaultfilters.py
@@ -76,7 +76,9 @@ def capfirst(value):
76 76
     ('&', r'\x26'),
77 77
     ('=', r'\x3D'),
78 78
     ('-', r'\x2D'),
79  
-    (';', r'\x3B')
  79
+    (';', r'\x3B'),
  80
+    (u'\u2028', r'\u2028'),
  81
+    (u'\u2029', r'\u2029')
80 82
 )
81 83
 
82 84
 # Escape every ASCII character with a value less than 32.
3  tests/regressiontests/defaultfilters/tests.py
@@ -83,6 +83,9 @@
83 83
 >>> escapejs(ur'<script>and this</script>')
84 84
 u'\\x3Cscript\\x3Eand this\\x3C/script\\x3E'
85 85
 
  86
+>>> escapejs(u'paragraph separator:\u2029and line separator:\u2028')
  87
+u'paragraph separator:\\u2029and line separator:\\u2028'
  88
+
86 89
 >>> fix_ampersands(u'Jack & Jill & Jeroboam')
87 90
 u'Jack &amp; Jill &amp; Jeroboam'
88 91
 

0 notes on commit 8931d8d

Please sign in to comment.
Something went wrong with that request. Please try again.