Re: [studs-user] Text field specialchars
Status: Beta
Brought to you by:
mojavelinux
|
From: Earnie B. <ea...@us...> - 2006-12-14 13:58:47
|
Quoting Juan Carlos Rey Anaya <jc...@um...>:
> Juan Carlos Rey Anaya wrote:
>> Hello again...
>> I have a form in which a field represents html code written by the user.
>> I have observed the text value that gets inserted in the DB is escaped.
>
> Well, One more time I have lost inside code and couldn't detect where
> the string is escaped :-(
> But, I have detected the function that makes the final espace:
>
> WEB_INF/lib/horizon/util/StringUtils::escapeString
>
> As I don't know is this behabiour is configurable, I have recurred to a
> home-made remedy :-)
> unescaping the final string returned by the ActionForm setter method.
> If it were of interest to somebody, here is the function that makes it.
>
>
> function unescapeString($string, $charsToUnescape = array('\''),
> $escapeChar = '\\')
> {
> foreach ($charsToUnescape as $charToUnescape)
> {
> $chr_unescaped = str_replace($escapeChar, '', $charToUnescape);
> $string = str_replace($escapeChar . $chr_unescaped, $chr_unescaped,
> $string);
> }
> return $string;
> }
>
Thanks. It makes sense that you need to unescape before setting the
values for the form elements.
Earnie Boyd
--
Please post responsibly:
* Use text posts instead of html; many list members just trash mail with html.
* Do not use multipart mime to send both text and html versions.
* Do not top post replies; post inline with the parts you are responding to.
* Trim the post replies; remove irrelevant information from the quoted
article.
* Original posters:
** Provide small complete examples of the problem.
** Provide the full command that produced errors.
** Provide the versions of the software used.
--
******************************************************************************
* The user of this server has agreed to allow the use of a trailer in the *
* mail that he sends for advertising purposes. This advertisment is added *
* by the server and is not in the control of the user of our services. *
******************************************************************************
Toshiba Satellite P105-S6114 Notebook
http://give-me-an-offer.com/offers/computers/laptop/toshiba
PlayStation 3 Auctions
http://give-me-an-offer.com/offers/auctions/au1
Samsung HP-S4253 42" High Definition Plasma TV
http://give-me-an-offer.com/offers/tv/plasma
|