| Summary: | Javascript error if the table cell contains the unicode character 2028 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Istvan Ballok <Istvan.Ballok> | ||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 1.4 | ||||||
| Target Milestone: | 1.4 M6 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 189598 [details]
proposed patch
Istvan, thanks for the patch. Applied patch to CVS HEAD. Now, the TableItemLCA#writeTexts uses WidgetLCAUtil.escapeText. JUnit tests updated. |
a related bug is 304364. To reproduce the problem: - open the controls demo, table tab, and change the text value of a table cell using widgets on the right hand side to a string that contains the unicode codepoint: 2028 (tip: on windows, by setting a registry key (http://en.wikipedia.org/wiki/Alt_codes#Unicode_characters), you can easily input this character by pressing ALT + "+" + 2028) Note: this semantic line separator character is sometimes found on websites, e.g. in the impressum, at the end of the line. After copying this text to a RAP application, where it is processed and displayed in a table, this error happens. The reason for this problem is that the resolution of bug: 304364 did not fix this issue in the table. Proposed solution: In TableItemLCA#writeTexts, use WidgetLCAUtil.escapeText to escape the text. That method correctly handles the "NonDisplayableCharacters", that the private #encodeHTML method did not do. Because WidgetLCAUtil.escapeText performs all the transformations that #encodeHTML did, it is safe to replace it. Note: the call to WidgetLCAUtil.escapeText is there, but commented out in the source code. Browsing the project history, I found that the commit: 4ad7ae62 (git mirror) introduced this change, on May 25 16:33:12 2007. Although the comment states it does not work with escape text, I think this information is deprecated and could not think of any reason, why it would not work. Just uncommenting this line seems to resolve the issue, without side effects.