Bug 27864 - Need ability to easily escape message text for display in javascript, xml or html
Summary: Need ability to easily escape message text for display in javascript, xml or ...
Alias: None
Product: Taglibs
Classification: Unclassified
Component: I18N Taglib (show other bugs)
Version: 1.0
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2004-03-22 23:35 UTC by Igor Fedulov
Modified: 2009-07-10 00:35 UTC (History)
0 users

Implementation for requested functionality is attached (33.23 KB, application/octet-stream)
2004-03-22 23:37 UTC, Igor Fedulov

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Fedulov 2004-03-22 23:35:28 UTC
Often it's needed to display a error message from i18n bundle in a javascript
alert box. Using following :

is not a good idea because some languages contain special characters that needs
to be escaped, or may contain "new line" character which will render above
javascript statement as a error. There is a solution that exists right now:

That looks cumbersome and not clean. Suggestion is to use something like this:
alert("<i18n:message key="someErrorMessageText" outputType="js"/>");

that will automatically render output message in proper format removing the need
to escape it manually.
Comment 1 Igor Fedulov 2004-03-22 23:37:53 UTC
Created attachment 10916 [details]
Implementation for requested functionality is attached
Comment 2 Igor Fedulov 2004-03-22 23:38:28 UTC
Sorry forgot the content type for the tar.gz files, the attachment is a .tar.gz
Comment 3 Henri Yandell 2009-07-10 00:35:21 UTC
JSTL replaced the i18n taglib, so this won't be worked on. If the String taglib is moved over to EL functions, it may appear there.