You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andy Jefferies <aj...@vrisko.com> on 2002/03/21 14:28:52 UTC
RE: BUG in org.apache.struts.util.ResponseUtils.filter(String val
ue) method in v.1.0.2
The function of this method is to conveniently ensure that
the text you're writing does not break or invalidate your
HTML/XHTML/XML.
E.g. convert "x <= y" to "x <= y" so that an XML processor
can process it (otherwise it could just throw an error).
However, if you converted
"two
lines"
to "two <br> lines" or "two <br/> lines" it could break some
folks XML as <br> may not be a valid tag.
You should look elsewhere for HTML specific tools. I don't
know of any I'm afraid.
Andy.
> -----Original Message-----
> From: Serge A. Redchuk [mailto:s.redchuk@kse.kiev.ua]
> Sent: 21 March 2002 11:44
> To: struts-user@jakarta.apache.org
> Subject: BUG in org.apache.struts.util.ResponseUtils.filter(String
> value) method in v.1.0.2
>
>
> Hello all !
>
> I think there is a bug in BUG in
> org.apache.struts.util.ResponseUtils.filter(String value)
> method in v.1.0.2
>
> This useful method states:
>
> public static String filter(String value) {
>
> if (value == null)
> return (null);
>
> char content[] = new char[value.length()];
> value.getChars(0, value.length(), content, 0);
> StringBuffer result = new StringBuffer(content.length + 50);
> for (int i = 0; i < content.length; i++) {
> switch (content[i]) {
> case '<':
> result.append("<");
> break;
> case '>':
> result.append(">");
> break;
> case '&':
> result.append("&");
> break;
> case '"':
> result.append(""");
> break;
> default:
> result.append(content[i]);
> }
> }
> return (result.toString());
>
> }
>
> All ok, but why this method does not converts '\n' to <br> ?
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>