Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: [S2] Struts encoding problem ?

Jacopo

2007-02-22

Replies:


I solved the problem with this method:

public static String euroAdjust(String value)
{
  if (value != null)
  {
   value = value.replaceAll("\u0080","\u20AC");
  }
  return value;
}

the param of the request is parsed with euroAdjust() and the right € euro
symbol is sent to db and saved.

When I read the € euro symbol from the db I have to convert like an HTML
entity.
If you use taglib <bean:message> it doesn't work.

I modified the taglib in struts.jar:

org.apache.struts.util.ResponseUtils.java

public static String filter(String value) {

      ...

    // add this lines to get euro HTML entity
    case'\u0080':
      filtered = "&euro;";
      break;

    case'\u20AC':
      filtered = "&euro;";
      break;

      ...

}
--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.