Stripping slashes from athlete names
-
Hi Conor,
When displaying results of athletes who have an apostrophe in their name (e.g. O’Donnell), I noticed that a backslash is displayed (e.g. O\’Donnell). I understand that the backslash is used to escape the apostrophe, so to remove the backslash I have made the following modifications:
- Added “stripSlashes” function to wpa-functions.js:
stripSlashes: function(str) { str=str.replace(/\\'/g,'\''); str=str.replace(/\\"/g,'"'); str=str.replace(/\/g,''); str=str.replace(/\\\\/g,'\\'); return str; }
- Modified “renderProfileLinkColumn” so that “data” is passed through the stripSlashes function:
... + WPA.stripSlashes(data) + ...
I wouldn’t be surprised if there’s a better way to resolve this, so would be interested in your thoughts of how and where to strip backslashes from data.
Cheers,
Clive - Added “stripSlashes” function to wpa-functions.js:
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Stripping slashes from athlete names’ is closed to new replies.