Make WordPress Core

Opened 8 years ago

Closed 6 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:


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 8 years ago.

Download all attachments as: .zip

Change History (6)

#1 @Denis-de-Bernardy
7 years ago

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

#2 @Denis-de-Bernardy
7 years ago

  • Keywords needs-patch added; has-patch removed

patch is b0rke.

#4 @Denis-de-Bernardy
6 years ago

  • Milestone changed from 2.8 to 2.9

punting per IRC discussion

#5 @azaozz
6 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.