Edgewall Software

Opened 10 years ago

Last modified 10 years ago

#11358 closed defect

add_script_data with U+2028/U+2029 characters lead a SyntaxError on Python 2.4/2.5 — at Initial Version

Reported by: Jun Omae Owned by:
Priority: normal Milestone: 0.12.6
Component: general Version: 0.12-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

In ECMA script, U+000a, U+000d, U+2028 and U+2029 characters are considers to be line terminators. json library is Therefore, we should escape those characters while passing to add_script_data, to_json, javascript_quote and to_js_string.

If Python 2.6+ which json library is available, the issue doesn't happen.

Adding the following

add_script_data(req, {'test': u'\u2029'})

… leads the following error in browser.

Uncaught SyntaxError: Unexpected token ILLEGAL

See http://bclary.com/2004/11/07/#a-7.3

Change History (1)

by Jun Omae, 10 years ago

Note: See TracTickets for help on using tickets.