Opened 12 years ago
Closed 12 years ago
#11358 closed defect (fixed)
add_script_data with U+2028/U+2029 characters lead a SyntaxError on Python 2.4/2.5
| Reported by: | Jun Omae | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.12.6 |
| Component: | general | Version: | 0.12-stable |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: |
Fix |
||
| 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
Attachments (1)
Change History (3)
by , 12 years ago
| Attachment: | unicode-line-terminators.diff added |
|---|
comment:1 by , 12 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:2 by , 12 years ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Committed in [12241] and merged in [12242,12243].



Proposed fix can be found in unicode-line-terminators.diff.