WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#7041 closed defect (bug) (fixed)

Strip \r on js escape

Reported by: nbachiyski Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version:
Component: JavaScript Keywords: js i18n needs-patch
Focuses: Cc:

Description

Now in the js_escape function, \r is stripped only if it is before \n.

I have seen many PO editors to insert \r in the end of translations, which breaks javascript.

I propose that we filter \r out of javascript strings. A patch is attached and tested.

Attachments (1)

no-cr-for-js-escape.diff (631 bytes) - added by nbachiyski 6 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Denis-de-Bernardy5 years ago

  • Component changed from i18n to JavaScript
  • Milestone changed from 2.9 to 2.8

comment:2 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; has-patch removed

patch is b0rke.

comment:4 Denis-de-Bernardy5 years ago

  • Milestone changed from 2.8 to 2.9

punting per IRC discussion

comment:5 azaozz5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11935]) Strip \r when escaping strings for JS, props nbachiyski, fixes #7041

Note: See TracTickets for help on using tickets.