You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by bu...@apache.org on 2004/03/10 06:21:41 UTC

DO NOT REPLY [Bug 18964] - string:encodeUrl does not work with accented characters

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=18964>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18964

string:encodeUrl does not work with accented characters





------- Additional Comments From nagoya@felipeal.net  2004-03-10 05:21 -------
Steve,

<str:encodeUrl> calls java.net.EncodeURL.encode(text) to encode the text.

The solution for your problem would be calling
java.net.EncodeURL.encode(text,encoding), but that method is only available on
J2SE 1.4.

We could add an attribute encoding for this tag and check the J2SE version at
runtime:


    public String changeString(String text) throws JspException {

      String result = null;
      if ( this.encoding != null ) {
        try {
          result = URLEncoder.encode( text, this.encoding );
        } catch( NoSuchMethodError exc ) {
          System.err.println( "WARNING: attribute encoding on tag encodeUrl
should be used only in  a " +
                            "J2SE 1.4 compatible web container. Using default
container.");
        } catch( UnsupportedEncodingException exc2 ) {
          System.err.println( "WARNING: unsupported encoding used on tag
encodeUrl: " + this.encoding );
        }
      }
      if ( result == null ) {
        result = URLEncoder.encode(text);
      }
      return result;
      
    }


So, Hen, what do you think about it? If you give me an ok, I will commit these
changes on CVS. Otherwise, we should mark it as WON'T FIX.

Felipe

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org